[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Help in getting data into CSV file
Ashish,
There is no easy way to do this in SQR. I would suggest two methods:
1. If you know a reasonable maximum limit on the number of fields, you can
do something like this:
unstring column_list by ',' into $c1 $c2 $c3 $c4 $c5 ...
begin-select
[$c1]
[$c2]
[$c3]
[$c4]
[$c5]
[etc]
However, either all the fields have to be the same type or you have to know
what type they are and assign the names to the right type of variable.
2. The second way is to use a first program to construct a portion of a
second program.
open 1 as 'whatever.inc' for-writing
begin-select
column-name
column-type
write 1 from &column_name
let $text = ' concat '','' with $out'
write 1 from $text
let $text = ' concat &column_name with $out'
write 1 from $text
from all_tab_columns
end-select
close 1
and in the second program
begin-select
#include whatever.inc
from $table-name
etc
I think you can take it from there ....
Dave
At 04:55 PM 10/22/2001 -0700, you wrote:
>Hi Peoplesoft and SQR Gurus,
>
>I hope you are doing fine today.
>
>I have in $select_statement all my column names, table name and the
>condition.
>
>My $select_statement is as below. It returns multiple rows.
>
>let $select_statement = "select
>EMPLOYER_APPROVED,PREV_SABB_ELIG_DT,AUDIT_OPRID from PS_AUDIT_ABS_HIST
>where AUDIT_STAMP < SYSDATE - 1300;"
>
>I want to run this in SQR and get data in CSV (Comma Separated) file.
>
>In the above statement fields and tables are dynamically created - meaning
>that no fix number of columns. The columns comes from ALL_TAB_COLUMNS.
>
>Is it possible in SQR ? Please reply.
>
>Thanks in advance.
>
>Have a nice day and great weekend.
>
>Regards.
>
>Ashish Bhatt.
Dave Donnelly <dave@isisbio.com>
ISIS BioComp phone (909) 677-2446 fax (781) 207-5533