Pl sql problem cursor and functions?
-
how can you make a function or a procedure call a cursor? does this have to do with the ref cursors? can anyone help me with the whole syntax eg. (sorry, i'll be using some shortcuts on the code) create or replace function/procedure call_cursor BEGIN ** calls the cursor END // cursor DECLARE cursor; BEGIN open da cursor FETCH the info display the info close end thank you very much!
-
Answer:
Not quite - think of the cursor as a temporary table. The DECLARE defines it, the OPEN populates it with data, the FETCH retrieves the next row of data and the CLOSE deletes the rows (may or may not need to follow with a DEALLOCATE or something similar to free-up storage). The normal process is: DECLARE cursorName AS SELECT whatever is required OPEN cursorName FETCH cursorName INTO host variable list WHILE (cursor not at EOF) (don't recall offhand what this variable called in PL/SQL) DO whatever processing required for one row of data FETCH cursorName INTO host variable list ENDDO CLOSE cursorName DEALLOCATE cursorName (if needed)
christian e at Yahoo! Answers Visit the source
Related Q & A:
- How can I optimize this dynamic SQL query in oracle with PL/SQL?Best solution by docs.oracle.com
- How to set Cursor in TextField?Best solution by Stack Overflow
- Are cursor.size() and cursor.count(true) equivalent?Best solution by stackoverflow.com
- How do I change the cursor from a blinking black block to a blinking line?Best solution by Server Fault
- Do piecewise functions have parent functions?Best solution by Ask.Metafilter.Com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.