R
R
Raushka2021-04-29 13:43:01
Oracle
Raushka, 2021-04-29 13:43:01

How to convert or transfer data from the cursor to excel or json by the returned sql function?

Hi all!
Please help me write the code further in order to somehow transfer or convert data to xml or json format to generate a report, thanks in advance!

create or replace FUNCTION FUNCBLKOPER(v_proccode varchar2,v_opercode varchar2 default null)
 RETURN SYS_REFCURSOR iS v_cursor SYS_REFCURSOR;
BEGIN
 OPEN v_cursor FOR
select /*+choose*/
S.CODE  BISN_CODE, T.ID, T.CODE OPER_CODE, T.NAME OPER_NAME,  
B.NFIRE NUM_BLOCK, B.LNAME NAME_BLOCK, B.EXEC_COND 
from CEN T,  TC_BLK B,  T_BPCR S 
WHERE T.ID = B.ID AND T.NORD = B.NORD AND T.ID = S.ID 
and T.ARCFL = '0'  and s.CODE = UPPER(v_proccode) 
ORDER BY T.NAME, B.NFIRE;
RETURN v_cursor;
END FUNCBLKOPER;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-04-29
@BasiC2k

If you are not very familiar with programming, then the easiest option is to set up an OLEDB connection in Excel and upload the data you need with an arbitrary request.
Brief algorithm:
1. Installing the driver for the required type of database in Windows OLEDB;
2. Setting up an OLEDB connection to the database;
3. Execution of a query and data output to an Excel sheet.
Of course, you need to take into account that
1. The database must be able to be connected from the outside;
2. With very large volumes of requested information, Excel will noticeably lag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question