View previous topic :: View next topic |
Author |
Message |
jayi Beginner
Joined: 13 Jun 2005 Posts: 4 Topics: 2 Location: Chicago
|
Posted: Tue Jun 28, 2005 12:45 am Post subject: Is it possible to open a Cursor inside a Scalar UDF? |
|
|
Is it possible to open a Cursor inside a Scalar UDF?Attempts to do the same are giving errors.However the same code when compiled as a procedure(with the return variable replaced with an OUT parameter) is compiling fine.Please help! |
|
Back to top |
|
 |
Joy Beginner
Joined: 09 May 2005 Posts: 7 Topics: 6 Location: Kolkata
|
Posted: Tue Jun 28, 2005 1:46 am Post subject: |
|
|
Hi Jayi,
Even I'm trying to do the same thing but its not working.The IBM DB2 Red Book contains code that has a cursor declaration within a UDF.But its not working for me |
|
Back to top |
|
 |
rublu Beginner
Joined: 14 Jun 2005 Posts: 5 Topics: 2
|
Posted: Tue Jun 28, 2005 10:00 pm Post subject: |
|
|
Could you give the error messages you are getting. Actually it is possible to open the cursor inside an UDF (procedures). _________________ ------------
Ruben |
|
Back to top |
|
 |
jayi Beginner
Joined: 13 Jun 2005 Posts: 4 Topics: 2 Location: Chicago
|
Posted: Wed Jun 29, 2005 12:32 am Post subject: |
|
|
Hi Rublu,
Here's the error code:DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "FOR" was found following " DECLARE C1
CURSOR". Expected tokens may include:
"<SQL_variable_condition_declaration>". LINE NUMBER=27. SQLSTATE=42601
sqlcode : -104 |
|
Back to top |
|
 |
rublu Beginner
Joined: 14 Jun 2005 Posts: 5 Topics: 2
|
|
Back to top |
|
 |
jayi Beginner
Joined: 13 Jun 2005 Posts: 4 Topics: 2 Location: Chicago
|
Posted: Wed Jun 29, 2005 9:10 am Post subject: |
|
|
Rublu,
My intention was not to return a result set.I was trying to perform an operation on each row of a table and form a concatenated string containing the values of only those rows that yielded a positive result to the processing.So I would have returned a string not a result set.Moreover I have tried opening cursors within Table Functions.Such attempts are throwing the same error |
|
Back to top |
|
 |
|
|