Keith Jamieson wrote:Correct, if you are just fetching the data in PL/SQL. The article, however, is talking about fetching the data within SQL. You won't do that with a locally defined PL/SQL type. ;)
excellent article. However there is one thing which is slightly erroneous. You don't need a type to be declared in the database to fetch the data, but you do need to declare a type;
user7734272 wrote:And this how to article, if you read it also contains the answer to this question
He then tries to fetch the returned REF CURSOR into a "local" REF CURSOR. I told him that I had never seen this done and believed it was not valid.
BluShadow wrote:So no, ref cursors do not contain data so cannot be fetched into. They can be assigned to though what the point of that would be I don't know and they are also primarily used for passing data to a non-PL/SQL environment like your original use of it, not for further processing in PL/SQL.
A common mistake is that people believe that a ref cursor actually contains the result data from the query.
In truth, the ref cursor doesn't contain any data at all, it's just a pointer to the query.
SQL> var c1 refcursor SQL> var c2 refcursor SQL> begin 2 open :c1 for select * from dual; 3 :c2 := :c1; 4 end; 5 / PL/SQL procedure successfully completed. SQL> print c2 D - X SQL>
user11951318 wrote:If you mean, "Are Ref Cursors the best thing to pass back from a stored procedure in order to query data back from the database?" then I would guess the answer is Yes as that is what they are primarily intended for. You can't "call" a stored procedure using a ref cursor as your question implies. However, this is an Oracle forum, not a Java forum, so the best practice for Java would be best asked on a Java forum.
Hi everyone !!
I have a question to ask you, and i hope you can help me.
Are Ref Cursors the best solution to call stored procedure from java code ?
Or there's another "best" way to do it ?
user11995078 wrote:Boneist has already given you the answer, but in future, consider posting your question on a thread of your own rather than hijacking something that is completely unrelated to your question.
I am executing this code toad but it does show the output of query , How can i get the out put of this code , I M USING TOAD