How do you get nicely formatted results from an oracle procedure that returns a reference cursor?



How do you get nicely formatted results from an oracle procedure that returns a reference cursor?..

Answer / Prabhat Yadav

To get nicely formatted results from an Oracle procedure that returns a REF CURSOR, you can use the DBMS_OUTPUT package to display the data.nn```sqln-- Prepare the procedurendbms_output.enable(10000);nCREATE OR REPLACE PROCEDURE get_data ISn cur_data SYS_REFCURSOR;nBEGINn OPEN cur_data FOR SELECT * FROM your_table;n DBMS_OUTPUT.PUT_LINE('Data:');n FOR rec IN cur_data LOOPn DBMS_OUTPUT.PUT_LINE(rec.column1 || ',' || rec.column2);n END LOOP;n CLOSE cur_data;nEND get_data;n-- Call the procedurendbms_output.put_line('Result:');nEXECUTE get_data;n``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Oracle General Interview Questions

How to save query output to a local file?

1 Answers  


What is the data pump import utility?

1 Answers  


t1 col1 col2 nishi 5000 lucky 6700 akash 7000 i want that a query that when i insert 7000 it will show me data already present and data will not insert. if data is not present it will insert.

2 Answers   MasterCard,


How to write text literals in oracle?

1 Answers  


What is the difference between alert log file and tarce file ?

1 Answers   TCS,


How do you find out from the RMAN catalog if a particular archive log has been backed-up?

1 Answers  


find out the second highest salary?

55 Answers   Cognizant, Nucsoft, Oracle, TCS, Wondersoft,


How view is different from a table?

1 Answers  


how to make an oracle object

1 Answers  


What is an external table?

1 Answers  


List the various oracle database objects?

1 Answers  


What is logical backup in oracle?

1 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1803)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)