Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Oracle/OAS
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Oracle/OAS
How to Pass Cursor Row as a parameter to another Function?
Sandeep John
Greenhorn
Posts: 3
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi All,
I Have Cursor
CURSOR ABC IS Select * from XYZ; BEGIN FOR REC IN ABC LOOP FUNCTION(); END LOOP;
Now I need to pass each row from cursor ABC as a parameter to FUNCTION().
Can some one tell me how to do that?
Gene Hilpert
Ranch Hand
Posts: 51
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm not sure if you want to call the function for each row in the select or if you want pass the cursor to the function.
For the first case include the function in the select
I.E.
select col1,col2,functioncall(col1) from table;
For the second
CREATE OR REPLACE FUNCTION schemaname.con_list (p_cursor IN SYS_REFCURSOR) RETURN VARCHAR2 IS l_return VARCHAR2(32767); l_temp VARCHAR2(32767); BEGIN LOOP FETCH p_cursor INTO l_temp; EXIT WHEN p_cursor%NOTFOUND; l_return := l_return || ',' || l_temp; END LOOP; close p_cursor; RETURN LTRIM(l_return, ','); END;
Then call it like:
SELECT ICEO.concatenate_list ( CURSOR (SELECT col10 FROM schemaname.tablename)) AS newlist FROM DUAL;
Hope this helps.
Sandeep John
Greenhorn
Posts: 3
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I guess you dint get my question correctly, Let me explain more detail..
From above example I have Cursor ABC.
Instead of doing
FUNCTION(REC.Col1, REC.Col2, REC.Col3)
I wanna send each record completely, what is the correct procedure of doing below
FUNCTION(REC);
Martin Vashko
Sheriff
Posts: 3837
66
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to the Ranch, Sandeep!
Please re-read Gene's answer. Does it pass individual columns from the cursor to the function or not?
Alternatively, you might perhaps use the
%ROWTYPE attribute
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JDBC & oracle function
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
Error in jdbc while executing procedure
How I can pass Cursor as In parameter
bean message in javascript
More...