Oracle

How to efficiently load mixed-type pandas DataFrame into an Oracle DB

删除回忆录丶 提交于 2021-02-10 18:18:18
问题 Happy new year everyone! I'm currently struggling with ETL performance issues as I'm trying to write larger Pandas DataFrames (1-2 mio rows, 150 columns) into an Oracle data base . Even for just 1000 rows, Panda's default to_sql() method runs well over 2 minutes (see code snippet below). My strong hypothesis is that these performance issues are in some way related to the underlying data types (mostly strings). I ran the same job on 1000 rows of random strings (benchmark: 3 min) and 1000 rows

How to update JSON column in oracle 12.1

。_饼干妹妹 提交于 2021-02-10 16:58:21
问题 Am trying to update a JSON column in oracle 12.1. Is there any json function that can be used to update the JSON. I have added a constraint JSON_COLUMN is JSON. I have tried : UPDATE tablename SET JSON = json_mergepatch(JSON, '{"STRUCTURE_NAME":null}'); But this function is applicable only for 19c This "STRUCTURE_NAME": "ABC:STATE:L12345", needs to be updated with "STRUCTURE_NAME":null 回答1: Pre-19c, if you want to change any values in a JSON document, you have to replace the whole thing:

Looping cursor throws error that cursor is not defined

青春壹個敷衍的年華 提交于 2021-02-10 16:55:37
问题 I want to loop results from stored procedure. My code: set serveroutput on VAR c_curs refcursor; EXECUTE pck_prov.get_value_type_list(1, :c_curs); BEGIN FOR record_test IN c_curs LOOP dbms_output.put_line(record_test.id); END LOOP; END; I don't understand why this is throwing error that c_curs must be declared: Error starting at line : 7 in command - BEGIN FOR record_test IN c_curs LOOP dbms_output.put_line(record_test.id); END LOOP; END; Error report - ORA-06550: line 2, column 24: PLS-00201

Looping cursor throws error that cursor is not defined

主宰稳场 提交于 2021-02-10 16:55:13
问题 I want to loop results from stored procedure. My code: set serveroutput on VAR c_curs refcursor; EXECUTE pck_prov.get_value_type_list(1, :c_curs); BEGIN FOR record_test IN c_curs LOOP dbms_output.put_line(record_test.id); END LOOP; END; I don't understand why this is throwing error that c_curs must be declared: Error starting at line : 7 in command - BEGIN FOR record_test IN c_curs LOOP dbms_output.put_line(record_test.id); END LOOP; END; Error report - ORA-06550: line 2, column 24: PLS-00201

Is it possible to run a sqlplus file inside a stored procedure?

隐身守侯 提交于 2021-02-10 15:56:01
问题 Hi is it possible to run and execute a sqlplus file from inside a stored procedure ? I have tried the following so far: CREATE OR REPLACE PROCEDURE SCRIPTRUN ( p_orgid IN VARCHAR2, p_axtype IN VARCHAR2, P_option IN VARCHAR2 ) AS runn VARCHAR2(200) := '@C:\Scripts\delete_ax\delete-ORG.sql '|| p_orgid ||' '|| p_axtype||' '|| P_option ; BEGIN execute IMMEDIATE runn; END SCRIPTRUN; Error Messages I'm getting : ORA-00900: invalid SQL statement ORA-06512: at "DWOLFE.SCRIPTRUN", line 17 ORA-06512:

Split Multiline CLOB Column - Oracle PL/SQL

喜夏-厌秋 提交于 2021-02-10 15:05:04
问题 I have a table which includes a CLOB field with values consisting of lines of comma-separated values. In the output I want a row for each these lines which start with a particular value. I also want to extract some of the comma-separated values performantly. Input table (3 rows): id my_clob 001 500,aaa,bbb 500,ccc,ddd 480,1,2,bad 500,eee,fff 002 777,0,0,bad 003 500,yyy,zzz Target output (4 rows): id my_clob line_num line second_val 001 500,aaa,bbb 1 500,aaa,bbb aaa 500,ccc,ddd 480,1,2,bad 500

How to calculate the average value of following n rows based on another column - SQL (Oracle)

岁酱吖の 提交于 2021-02-10 15:00:40
问题 I am trying to calculate average monthly value of premiums for each POLICY_ID in monthly basis as shown below. When a customer updates his/her yearly payment frequency to a value different than 12, I need to manually calculate the average monthly value for the PREMIUM. How can I achieve the values shown in MONTHLY _PREMIUM_DESIRED? Thanks in advance. Note: Oracle version 12c What I've tried: SELECT T.*, SUM(PREMIUM) OVER(PARTITION BY T.POLICY_ID ORDER BY T.POLICY_ID, T.PAYMENT_DATE ROWS

How to calculate the average value of following n rows based on another column - SQL (Oracle)

非 Y 不嫁゛ 提交于 2021-02-10 14:57:45
问题 I am trying to calculate average monthly value of premiums for each POLICY_ID in monthly basis as shown below. When a customer updates his/her yearly payment frequency to a value different than 12, I need to manually calculate the average monthly value for the PREMIUM. How can I achieve the values shown in MONTHLY _PREMIUM_DESIRED? Thanks in advance. Note: Oracle version 12c What I've tried: SELECT T.*, SUM(PREMIUM) OVER(PARTITION BY T.POLICY_ID ORDER BY T.POLICY_ID, T.PAYMENT_DATE ROWS

How to calculate the average value of following n rows based on another column - SQL (Oracle)

最后都变了- 提交于 2021-02-10 14:57:11
问题 I am trying to calculate average monthly value of premiums for each POLICY_ID in monthly basis as shown below. When a customer updates his/her yearly payment frequency to a value different than 12, I need to manually calculate the average monthly value for the PREMIUM. How can I achieve the values shown in MONTHLY _PREMIUM_DESIRED? Thanks in advance. Note: Oracle version 12c What I've tried: SELECT T.*, SUM(PREMIUM) OVER(PARTITION BY T.POLICY_ID ORDER BY T.POLICY_ID, T.PAYMENT_DATE ROWS

Is Auto_Increment supported in Oracle using Liquibase

≯℡__Kan透↙ 提交于 2021-02-10 14:30:02
问题 I want to add an auto_increment column in an oracle database using liquibase script. I have tried using the auto_increment attribute in liquibase : <column name="SUPPLEMENT_ID" type="INTEGER" autoIncrement="true" > <constraints primaryKey="true"></constraints> </column> If oracle supports auto_increment, how can I achieve it using liquibase scripts? 回答1: IDENTITY columns are introduced in oracle 12c which allows users to create auto increment columns But if you are using older versions you