The second part of the question: How to do the same (get ALL results, without any loops) with SQL*Plus.
I'm writing some PL/SQL scripts to test the data integrity using Jenkins.
I'm having a script like this:
declare temp_data SOME_PACKAGE.someRefCurFunction; // type: CURSOR DATA1 NUMBER; DATA2 NUMBER; DATA3 SOMETHING.SOMETHING_ELSE%TYPE; begin cursor := SOME_PACKAGE.someFunction('some',parameters,here); LOOP FETCH cursor INTO DATA1,DATA2,DATA3; EXIT WHEN temp_data%NOTFOUND; dbms_output.put_line(DATA1||','||DATA2||','||DATA3); END LOOP; end;
Relsults look like this:
Something1,,Something2 Something3,Something4,Something5 Something6,Something7,Something8
Sometimes the results are null, as in the 1st line. It doesnt matter, they should be.
The purpose of this script is simple - to fetch EVERYTHING from the cursor, comma separate the data, and print lines with results.
The example here is simple as hell, but It's just and example. The "Real life" Packages contain sometimes hundreds of variables, processing enormous database tables.
I need it to be as simple as possible.
Is there any method to fetch EVERYTHING from the cursor, comma separate single results if possible, and send it to output? The final output in the Jenkins test should be a text file, to be able to diff it with other results.
Thanks in advance :)