![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've got a PL/SQL function that returns a SYS_REFCURSOR. I'm using SQL Developer, and trying to call it and display what it's returned. And I don't have a clue how to do it. Help! -- Tim Slattery Slatter... (AT) bls (DOT) govhttp://members.cox.net/slatteryt |
r select the function from dual:
#3
| |||
| |||
|
|
I've got a PL/SQL function that returns a SYS_REFCURSOR. I'm using SQL Developer, and trying to call it and display what it's returned. And I don't have a clue how to do it. Help! -- Tim Slattery Slatter... (AT) bls (DOT) govhttp://members.cox.net/slatteryt |
#4
| |||
| |||
|
You fetch from the refcursor r select the function from dual:SQL> select get_tab_data('EMP') from dual; |
#5
| |||
| |||
|
|
The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. |
#6
| |||
| |||
|
|
Tim Slattery <Slatter... (AT) bls (DOT) gov> wrote: The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. I saw a web post that may have the answer. He says that a common cause of this is that select permission on the table has been granted to a role, and that role has then been assigned (granted? not sure of the proper terminology) to me. But that role does not propagate to functions that I write. The result is just what I'm seeing: I can select from the table directly, but the function can't find it. Seems an irrational way for things to work, but then I'm only a developer... -- Tim Slattery Slatter... (AT) bls (DOT) gov |
#7
| |||
| |||
|
|
Tim Slattery<Slattery_T (AT) bls (DOT) gov> wrote: The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. I saw a web post that may have the answer. He says that a common cause of this is that select permission on the table has been granted to a role, and that role has then been assigned (granted? not sure of the proper terminology) to me. But that role does not propagate to functions that I write. The result is just what I'm seeing: I can select from the table directly, but the function can't find it. Seems an irrational way for things to work, but then I'm only a developer... |
#8
| |||
| |||
|
|
Tim Slattery wrote: Tim Slattery<Slattery_T (AT) bls (DOT) gov> wrote: The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. I saw a web post that may have the answer. He says that a common cause of this is that select permission on the table has been granted to a role, and that role has then been assigned (granted? not sure of the proper terminology) to me. But that role does not propagate to functions that I write. The result is just what I'm seeing: I can select from the table directly, but the function can't find it. Seems an irrational way for things to work, but then I'm only a developer... If you'd like to become a good developer, don't use dynamic SQL. |
#9
| |||
| |||
|
|
Am 08.02.2012 19:39, schrieb Gerard H. Pille: Tim Slattery wrote: Tim Slattery<Slattery_T (AT) bls (DOT) gov> wrote: The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. I saw a web post that may have the answer. He says that a common cause of this is that select permission on the table has been granted to a role, and that role has then been assigned (granted? not sure of the proper terminology) to me. But that role does not propagate to functions that I write. The result is just what I'm seeing: I can select from the table directly, but the function can't find it. Seems an irrational way for things to work, but then I'm only a developer... If you'd like to become a good developer, don't use dynamic SQL. If you'd like to become a superb developer, learn how to use dynamic SQL at great depth, know what bind variables are good for, learn what excessive parsing means to your application performance... And then you learn when dynamic SQL is appropriate and when not. DBMS_SQL, EXECUTE IMMEDIATE and OPEN ... FOR '...' can do magic in the hand of PL/SQL wizards ;-) Regards Peter |
#10
| |||
| |||
|
|
Peter Schneider wrote: Am 08.02.2012 19:39, schrieb Gerard H. Pille: Tim Slattery wrote: Tim Slattery<Slatter... (AT) bls (DOT) gov> wrote: The "select" statement works when I run it from the SQL developer console. But when I call the function I'm told "table or view does not exist". But it *does* exist. I saw a web post that may have the answer. He says that a common cause of this is that select permission on the table has been granted to a role, and that role has then been assigned (granted? not sure of the proper terminology) to me. But that role does not propagate to functions that I write. The result is just what I'm seeing: I can select from the table directly, but the function can't find it. Seems an irrational way for things to work, but then I'm only a developer... If you'd like to become a good developer, don't use dynamic SQL. If you'd like to become a superb developer, learn how to use dynamic SQL at great depth, know what bind variables are good for, learn what excessive parsing means toyour application performance... And then you learn when dynamic SQL is appropriate and when not. DBMS_SQL, EXECUTE IMMEDIATE and OPEN ... FOR '...' can do magic in the hand of PL/SQL wizards ;-) Regards Peter And bring a production database to its knees. |
![]() |
| Thread Tools | |
| Display Modes | |
| |