plsqldeveloper

How to create cursor inside procedure body in plsql

浪尽此生 提交于 2019-12-05 17:55:08
I want create cursor inside procedure body dynamically also i have to use for loop instead of below code. i did the dynamic cursor but i cannot use the for loop. PROCEDURE myprocedure AS LV_TEST_CUR SYS_REFCURSOR; LV_QUERY VARCHAR2(200); LV_DATE DATE; BEGIN LV_QUERY:='select sysdate as mydate from dual'; OPEN LV_TEST_CUR FOR LV_QUERY; /*FOR CUR_VAR IN LV_TEST_CUR LOOP dbms_output.put_line(CUR_VAR.mydate); end LOOP; */ LOOP FETCH LV_TEST_CUR INTO LV_DATE; EXIT WHEN LV_TEST_CUR%NOTFOUND; DBMS_OUTPUT.PUT_LINE(LV_DATE); END LOOP; CLOSE LV_TEST_CUR; END myprocedure; if i am using commented code(for

Oracle PL Sql Developer cannot find my tnsnames.ora file

自闭症网瘾萝莉.ら 提交于 2019-12-04 18:41:19
问题 I have an Oracle tnsnames.ora file from my previous workplace. I want to pick it up with my newly installed PL SQL Developer on another computer. I have copied the file into ..ORACLE/product/11.2.0/client_32/NETWORK/ADMIN but PL SQL Developer cannot find it. When it starts it is not showing me any choice of database. In About->i->TNSNames I dont see any lines I have found a number of advices to look for it in Tools->Preferences->Database->..., but I dont have a Database tab in my preferences.

diff local package with database package

拈花ヽ惹草 提交于 2019-12-04 16:41:22
I need somehow compare local version of pl sql package with the one that is stored in database. Are there any "easy" way to do it? Currently I download package from database, save it in some file and perform diff using some diff tool. That is a bit cumbersome, so I would like to have such feature in ide (pl sql developer is preferable). Typically developers use versioning software to check differences, maintain version history, and help coordinate team development of code. PL/SQL code should be no different. There's many ways to handle code releases, the following is just what I've seen done,

pragma autonomous_transaction in a trigger

谁说我不能喝 提交于 2019-12-04 09:21:15
I have written a trigger on one table which deletes data from other table upon a condition. The trigger has pragma autonomous_transaction, and trigger works as intended. However, I do wonder if there can be any problems in future, say if data is inserted by multiple users/sources at the same time etc...Any suggestions? Source table t1: -------------------------------------------- | user_id | auth_name1 | auth_name2 | data | -------------------------------------------- | 1 | Name1 | Name2 | d1 | | 2 | Name3 | Name4 | d2 | | 3 | Name5 | Name1 | d3 | --------------------------------------------

How to print SYS_REFCURSOR with PLSQLDeveloper window?

泪湿孤枕 提交于 2019-12-04 04:16:45
问题 In the below query how to get IO_CURSOR values in PL/SQL's "SQL Window" DECLARE SOME_VAR_1 VARCHAR2(20); SOME_VAR_2 VARCHAR2(20); SOME_VAR_3 DECIMAL; IO_CURSOR SYS_REFCURSOR; BEGIN SOME_VAR_1 := 'test1'; SOME_VAR_2 := 'test2'; SOME_VAR_3 := 1; IO_CURSOR := NULL; Get_Analysis_Data(p_in_symbol_type => SOME_VAR_1, p_in_symbol => SOME_VAR_2, p_in_isr_id => SOME_VAR_3, isr_main_view => IO_CURSOR); PRINT IO_CURSOR END; 回答1: If by "SQL Window" you mean SQL*PLUS ,then to print(using PRINT command)

How to create a dump with Oracle PL/SQL Developer?

折月煮酒 提交于 2019-12-03 12:27:44
问题 I need to take dump of a user (including tables, procedures ,etc.) as FILENAME.dmp . If I create a new user and import that FILENAME.dmp , then everything should be created. How can I create this dump file? Don't tel me to use the Run > EXP or Run > IMP functions because, due to some problem, that feature is not working for me. 回答1: EXP (export) and IMP (import) are the two tools you need. It's is better to try to run these on the command line and on the same machine. It can be run from

Oracle PL Sql Developer cannot find my tnsnames.ora file

匆匆过客 提交于 2019-12-03 11:56:19
I have an Oracle tnsnames.ora file from my previous workplace. I want to pick it up with my newly installed PL SQL Developer on another computer. I have copied the file into ..ORACLE/product/11.2.0/client_32/NETWORK/ADMIN but PL SQL Developer cannot find it. When it starts it is not showing me any choice of database. In About->i->TNSNames I dont see any lines I have found a number of advices to look for it in Tools->Preferences->Database->..., but I dont have a Database tab in my preferences. How can I fix it? If you are certain your tnsnames.ora file is correct (eg by testing the connection

How to create a dump with Oracle PL/SQL Developer?

蓝咒 提交于 2019-12-03 02:53:29
I need to take dump of a user (including tables, procedures ,etc.) as FILENAME.dmp . If I create a new user and import that FILENAME.dmp , then everything should be created. How can I create this dump file? Don't tel me to use the Run > EXP or Run > IMP functions because, due to some problem, that feature is not working for me. Guy EXP (export) and IMP (import) are the two tools you need. It's is better to try to run these on the command line and on the same machine. It can be run from remote, you just need to setup you TNSNAMES.ORA correctly and install all the developer tools with the same

How to parse comma delimited string in PL/SQL? [duplicate]

落花浮王杯 提交于 2019-12-03 00:27:18
This question already has an answer here: How to convert comma separated values to rows in oracle? 4 answers I have a comma delimited string in a PL/SQL script (e.g. data:= 'a,b,c,d,e'), that I need to parse out within the script. I would like to loop through the string and process each item. Like a 'foreach' loop. Is this possible in PL/SQL? Can someone point me to some code? If you are on Oracle 10G or 11G then you should have a built-in Apex function apex_util.string_to_table : SQL> declare 2 v_array apex_application_global.vc_arr2; 3 v_string varchar2(2000); 4 begin 5 6 -- Convert

Encountered the symbol “end-of-file” when expecting one of the following

风格不统一 提交于 2019-12-02 23:33:16
问题 I'm trying to print Fibonacci series in plsql this is the procedure CREATE OR REPLACE PROCEDURE fibos(n IN number) IS DECLARE first number := 0; second number := 1; temp number; i number; BEGIN dbms_output.put_line('Series:'); dbms_output.put_line(first); dbms_output.put_line(second); for i in 2..n loop temp:=first+second; first := second; second := temp; dbms_output.put_line(temp); END loop; END; / Warning: Procedure created with compilation errors. and this is the where I call procedure: