How to run the sys_refcursor in a procedure
HelloHow to call the following procedure
create or replace procedure
proc_ref_cursor (rc in sys_refcursor) as
v_a number;
v_b varchar2(10);
begin
loop
fetch rc into v_a, v_b;
exit when rc%notfound;
dbms_output.put_line(v_a || ' ' || v_b);
end loop;
end;
/
Guide me so call this procedure / / I have tried but no luck
SQL> create or replace procedure
2 proc_ref_cursor (rc in sys_refcursor) as
3
4 v_a number;
5 v_b varchar2(10);
6
7 begin
8 loop
9 fetch rc into v_a, v_b;
10 exit when rc%notfound;
11 dbms_output.put_line(v_a || ' ' || v_b);
12 end loop;
13 end;
14 /
Procedure created.
SQL> set serveroutput on
SQL>
SQL> ed
Wrote file afiedt.buf
1 declare
2 r sys_refcursor;
3 begin
4 open r for
5 select 1, '2' from dual;
6 proc_ref_cursor (r);
7 close r;
8* end;
9 /
1 2
PL/SQL procedure successfully completed.
Published by: bluefrog on February 5, 2010 10:12
Published by: I forgot to close the cursor!
Tags: Database
Similar Questions
-
How to create the script to compile procedure files in oracle. about to go live and have much .prc pkg in a directory usr/tmp/ar... Po... human resources etc. need to create a script to compile all the files in the folder, then do not open all necessary .prc suggestions on how to do it. Thank you Tom.
(1) an urgent need, ASAP,... are words that do not in a forum of volunteer. We are here to help if you need it now, for free, open a SR.
(2) oracle procedures are not files.
(3) I think you are trying to run operating system packages, no Oracle procedure. right?
-
How to find the id of session procedure
How to find the id of my procedure proc1 session when I am running.
Thank youYou can use this function USERENV ('SESSIONID').
where sessionid parameter.for example
SQL> select userenv('SESSIONID') from dual ; USERENV('SESSIONID') -------------------- 563
SS
-
Lean how to run the stop code when the highest level VI ends
Hi people.
I am a newbie of LV with 30 years of experience in embedded SW engineering. I searched for how to run the stop code when a VI of highest level ends. I found many examples, but they are horribly complicated. A little birdie told me that such a model of simple design should not be so compilicated.
My application is an application of high tension control to disable all HV checkpoints when the SW ends. My VI code is running in a while loop with a stop button that leads out of the loop. I can easily accomplish my requirement by programming with a sequence of plate that runs after the end of the main loop. The technique of flat sequence does not work when the user clicks the Cancel button in the toolbar of façade, more than that market when the user clicks the close button of the application (X button) when you run the exe application.
Can someone tell me please a simple technique, the code example that can show me a lean and elegant way to accomplish my task? It doesn't have to be an obvious solution (for example a stop induced watchdog seems simple enough).
Thank you - John Speth
1. place this code in a VI:
(also attached)
Calling code in your VI of highest level like this:
-
How to run the VI developed in labVIEW 2011 in its previous versions
Hi all
I am currently using LabVIEW 2011 in my PC at home.
But, all my school's computers are installed with LabVIEW 2010 and 2010 SP1.
How to run the VI developed in LabVIEW 2011 in its previous versions?
Is there any conveter why?
Concerning
Prasanth T
Open the VI in LabVIEW 2011 and use the file menu option, save for the previous Version.
-
How to run the Extendscript .bat file?
I have a file with some instructions .bat and I want that it runs from Extendscript.
How to run the Extendscript .bat file?
I tried execute(); order and it seems that .bat ran but no result, but when I double click on the .bat file all worksout very well.
How used runtime.exec () extend the script?
Can I communicate with Java JDK thru ExtendScript and run commands such as runtime.exec ()?
can someone please?
You can do it like this:
var batFile = new File("C:\\path\\to\\my\\batfile.bat"); batFile.execute();
Note that this will only work if your system is configured in such a way that by double-clicking the .bat file runs it in reality.
You can also use
system.callSystem()
but note that this is only available in AE.
-
What is tdrc.tdrcfacade and how to run the installation wizard?
What is tdrc.tdrcfacade and how to run the installation wizard? My desktop creative cloud application does not open properly... it is just a blank window.
Much obliged,
Angiecrichards@gmail.com
! !
Are Angie, you a blank white screen? What version of OS are you using?
Here's what you can try:
- Blank white screen. Sign in | Creative cloud Packer
- New application Cloud Creative unusable: it is empty!
- Creative cloud Packager white screen after the Adobe ID Login
- Re: screen creative black cloud
Waiting for your response.
-
I downloaded items on my mac and it installed. How to run the program?
I downloaded items on my mac and it installed. How to run the program.
Hi David,
You can simply click on the application to launch from the folder "Applications".
-
How to run the repository creation utility (11.1.1.3.3)
Hi experts, I downloaded utility creation (11.1.1.3.3) at oracle.com repository as I was told to run it before installing Oracle Business Intelligence, v. 11.1.1.3.0, I already unzipped the UCR, my problem is I do not know where and what run.i I ask the name of the file to be executed, the location of this file because there are so many issues after having unpacked the downloaded file. Finally, how to run the file (for example by double-clicking). Thank youVisit this link,
http://obiee101.blogspot.com/2010/08/obiee11g-installation-on-32-bits-XP-Pro.html
He noted the location of the controls on the remote file, double click will start the process.
Thank you
Vino -
[CS4:JS] How to run the file ".sh" via Javascript
Dear all,
How to run the file ".sh" through Adobe InDesign Javascript, I used the code below:
//================== Code =============================//
var myFile = File("xxx/xxx/xxx/Test.sh");
var Exec = "sh" + "" + "\""+myFile+"\;"
Leader (exec). Execute();
//================== End =========================//
codes above does not work, I checked before without the "sh" in addition, it does not work.
Please can someone give me the solutions and the suggestion, and I'd appreciate it.
Thanks and greetings
SudhaN T.R.Harihara.,.
Have your IDMLExportparse.sh file runs permission set?
If you open Terminal.app and type
/Applications/MacXinPro/IDMLExportparse.sh
It work? Or do you need to run "sh"? If so, either adjust the
permissions with
chmod a + x /Applications/MacXinPro/IDMLExportparse.sh
or modify the JavaScript code for:
shell("sh "+myFile);
-
How to run the Config tool?
We are Linux running Essbase 11.1.1.3 - can someone tell me how to run the Config tool?Hello
Try. /
/common/config/9.5.0.0/configtool.sh More information:-http://download.oracle.com/docs/cd/E12825_01/epm.111/epm_install/ch04s05.html
See you soon
John
http://John-Goodwin.blogspot.com/ -
Hello
I have a form based on the table that store only 1 card. I have created a form page, but may not know how to run the query and display the record in the table. If there is no record in the table, I want that the user can use this page to create a record.
Thanks in advance
NRIHello Nri,
What value does P18_SCHOOL_ID?
If you look at the State of Session (toolbar) developer. If that does not have a value, it's your problem.You can create a calculation before the process that gives the correct value. (In one case more often, you have a report and when you click on the link change that id is activated and you see the recording in your form)
Dimitri
-
How to run the packaged procedure with Ref Cursor
Hello.
The question may be very simple for you... but I was confused how to run
I have the following package
But I want to test (run) this procedure...CREATE OR REPLACE PACKAGE CURSPKG AS TYPE T_CURSOR IS REF CURSOR; PROCEDURE OPEN_ONE_CURSOR (N_EMPNO IN NUMBER, IO_CURSOR IN OUT T_CURSOR); END CURSPKG; / CREATE OR REPLACE PACKAGE BODY CURSPKG AS PROCEDURE OPEN_ONE_CURSOR (N_EMPNO IN NUMBER, IO_CURSOR IN OUT T_CURSOR) IS V_CURSOR T_CURSOR; BEGIN IF N_EMPNO <> 0 THEN OPEN V_CURSOR FOR SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME FROM EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO AND EMP.EMPNO = N_EMPNO; ELSE OPEN V_CURSOR FOR SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME FROM EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO; END IF; IO_CURSOR := V_CURSOR; END OPEN_ONE_CURSOR; END CURSPKG; /
But confused how to have Ref Cursor
Could you help me in this...
Thank youYou must declare a variable of type T_CURSOR and pass it to the procedure like this.
declare lOutCursor CURSPKG.T_CURSOR; begin CURSPKG.OPEN_ONE_CURSOR(
, lOutCursor); end; -
I need to know how to run a chkdsk utility laptop always tells me that I have a corupt file and to run, but I can't understand how do
There is a link in the post above say you how to operate!
Your computer does not seem to allow links to work, I'll post it for you:
- Click Startand then click run.
- In Open, type cmd and then press ENTER.
- Use one of the following procedures:
- To run Chkdsk in read-only, at the command prompt, type chkdsk, and then press ENTER.
- To repair errors without scanning the volume for bad sectors, at the command prompt, type chkdsk/f and press ENTER.
Note If one or more files on the hard disk are open, you will receive the following message is displayed:
Chkdsk cannot run because the volume is in use by another process. You want to schedule this volume to check the next time the system restarts? (Y/N)Type Y, and then press ENTER to schedule the disk check, and then restart your computer to start the disk check.
- To repair errors, locate bad sectors, and recover readable information, at the command prompt, type chkdsk/r, and press ENTER.
Note If one or more files on the hard disk are open, you will receive the following message is displayed:
Chkdsk cannot run because the volume is in use by another process. You want to schedule this volume to check the next time the system restarts? (Y/N)Type Y, and then press ENTER to schedule the disk check, and then restart your computer to start the disk check.
-
How to run the type of object...
HI team,
Please let me know how to run pl/SQL object type.
create or replace TYPE T_PARTY_ID_LIST AS TABLE OF T_PARTY_ID; create or replace TYPE T_PARTY_ID AS OBJECT (SEQ NUMBER(10,0) ,COUNTRY_ID CHAR(2) ,ID VARCHAR2(50) ,ID_TYPE VARCHAR(3) ,DATE_FROM DATE ,DATE_TO DATE ); create or replace PROCEDURE P_UPDATE_RICA_COUNT_ID (A_PARTY_IDS IN T_PARTY_ID_LIST ,A_ICAP_ID IN number ) as v_id sa_id_registration_counts.id%TYPE; -- BEGIN FOR C IN (SELECT X.id_type, X.ID FROM TABLE (CAST(A_party_ids AS T_PARTY_ID_LIST)) X WHERE X.ID_Type IN ('N','P','B') ORDER BY X.ID_Type) LOOP -- BEGIN -- UPDATE sa_id_registration_counts SET no_of_registrations = no_of_registrations-1 WHERE id = V_ID AND id_type = C.ID_Type; -- IF SQL%ROWCOUNT < 1 THEN RAISE NO_DATA_FOUND; END IF; -- EXCEPTION WHEN NO_DATA_FOUND THEN BEGIN -- INSERT INTO sa_id_registration_counts (id ,id_type,exclude_yn,no_of_registrations) SELECT V_ID,C.ID_Type,'N',1 FROM dual; -- EXCEPTION WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20000,'Error updating RICA ID count ['||SQLERRM||']'); END; END; -- END LOOP; -- END; --
I'm trying, but receive an error message
DECLARE A_PARTY_IDS SCOTT.T_PARTY_ID_LIST; A_ICAP_ID NUMBER :=12323; BEGIN A_PARTY_IDS.extend(1); SELECT T_PARTY_ID(1,'1','1','1',null,null) INTO A_PARTY_IDS(1) FROM DUAL; P_UPDATE_RICA_COUNT_ID( A_PARTY_IDS => A_PARTY_IDS, A_ICAP_ID => A_ICAP_ID ); END; Error report - ORA-06531: Reference to uninitialized collection
I do not know why you do what you do that is row-by-row (aka slow-by-slow), when you could do all this in a single merge - something like statement:
create or replace PROCEDURE P_UPDATE_RICA_COUNT_ID (A_PARTY_IDS IN T_PARTY_ID_LIST, A_ICAP_ID IN number) as begin merge into sa_id_registration_counts tgt using (select x.id_type, x.id, count(*) cnt from table(cast(a_party_ids as t_party_id_list)) x where x.id_type in ('N', 'P', 'B') group by x.id_type, x.id) src on (tgt.id_type = src.id_type and tgt.id = src.id) when matched then update set no_of_registrations = no_of_registrations - src.cnt when not matched then insert (tgt.id, tgt.id_type, tgt.exclude_yn, tgt.no_of_registrations) values (src.id, src.id_type, 'N', 1); end; /
You v_id in your procedure, but you never defined anywhere, for as far as I could tell, so I made a few assumptions about the join condition. You will need to change if necessary.
Meanwhile, for your procedure, you should do something like:
DECLARE A_PARTY_IDS T_PARTY_ID_LIST := t_party_id_list(); -- initialised the collection here A_ICAP_ID NUMBER :=12323; BEGIN A_PARTY_IDS.extend(1); A_PARTY_IDS(1) := T_PARTY_ID(1,'1','1','1',null,null); P_UPDATE_RICA_COUNT_ID( A_PARTY_IDS => A_PARTY_IDS, A_ICAP_ID => A_ICAP_ID ); end; /
Another thing - you seem to like selection of the many double - if you're in PL/SQL, then you can just assign variables directly (overall; there are a few exceptions, depending on your version of the database).
Maybe you are looking for
-
Sort by title wrong with iOS10 in iTunes
The view "all by title" is not correct in iOS10. The sorting is now by the artist. The bug occurs on 7 more iPhone and iPad 9.7 pro No problem with iTunes on Mac OS Sierra... all the co
-
Backup of files (Windows 8)
How can I save my files if they are not in libraries, desktop, Favorites, or contacts? As I understood the history of the files does not provide such a possibility. (Am I wrong?) So, how can I solve this task and automate the process (using Windows o
-
Mounted the case for POWERSHOT SX50HS
Hello -What someone has a suggestion for a case for my camera. Amazon has an Everready case it seems to be described as a product of inner quality. Canon has one on the site of tneir as well. Thank you guys!
-
I just set up my home network with multiple computers and point of access, by using the same names and passwords that I had the original computer. When I stopped and restarted, I was invited with a different message box appearance request my usernam
-
Dear Sir. In my laptop of HP in the Device Manager, another peripheral had to insatall a pilot, this hardware id is: ACPI\VEN_INT & DEV_33BD & REV_0002ACPI\VEN_INT & DEV_33BDACPI\INT33BD* INT33BD and another is : PCI\VEN_8086 & DEV_0F18 & SUBSYS_2213