Thanks for this I've managed to get it working thus:
PAY_GROUP=`sqlplus -s $ORAUSR_PWD << EOF
set heading off
set feedback off
SELECT substr(payroll_name,-3,length(payroll_name))
FROM pay_payrolls_f
WHERE payroll_id = $PAYROLL_ID
AND TRUNC(SYSDATE) BETWEEN effective_start_date AND...
Hi All,
I'm trying to do the following:
Generate an output file from an SQL statement in a unix script.
The name of the file should be dependent on one of the parameters that is used to call the UNIX script. I have enclosed what I have so far.
-- This statement should give me an output, but its...
Hi,
I'm extracting data from a temporary table that has been updated and inserted into using pl/sql. The columns are being concatenated as the data is needed as a csv file.The error I get is:
ERROR at line 1:
ORA-01489: result of string concatenation is too long.
Any ideas on how I can bypass...
Hi,
May be I did not explain very well what I intend to do. I actually need to process the individual columns of every row individually. After this has been done a final variable, for instance a number is generated for each row. If I do have 4 rows then the cummulative of the 4 rows is what is...
Thanks everyone for this. The records being retrieved are the last two records.
New issue, given that I have not used pl/sql tables, the requirements have now changed.
I need to capture all the data from the cursor and use them cummulatively. That is, I need to add the value of a column in the...
Hi,
Thanks for this. One question, given that I'm using mutiple tables how do I use the bulk collect. It seems the syntax given is based on one table.
Thanks again
Hi,
I have never used plsql tables before. I am trying to retrieve the last two rows from a cursor. What I intend to do is use the individual variables for each of the rows to carry out some calculations between the two rows. The set of record being retrieved is a mix of old and new data. By...
Thanks. I have tried your suggestion, but still came up with no results. I'm not sure if this has got to do with some of the setting on the UNIX box itself or the some UTL settings.
T
Hi Guys,
I need some advice on how to output some text unto UNIX.
What I intend doing in a loop is output data similar to what will be output when you run the query below:
select 'Staff ID'||','||
'First Name'||','||
'Last Name'||','||...
Thanks everyone so much for the ideas contributed. I have resorted to getting the data a different way using pl/sql's utility UTL_FILES.
I have learned a few things about sed from feherke which I believe will come in handy soon
Thanks
That is bang on what I intend to read I was adding ^M as I need to start a new line after each record. Any ideas on how I can get this reproduced in sql to be read by excel in csv format? Ideas please. Thanks a lot so far.
I really appreciate the fact that you keep coming up with very good ideas, but the awk i just tried did not work. I got the following error:
syntax:
awk '/,$/{l=$0;next}l{$0=l $0;l=""}1' CBT_25102005.csv > CBT_25102005.nocsv
error:
awk: syntax error near line 1
awk: bailing out near line 1
Any...
Thanks for all the input. But I'm not getting the desired result when I view via CSV in excel. What I desire is this:
2672,joe.bloggs@hotmail.com,First Name,mary^M2672,joe.bloggs@hotmail.com,Last Name,jane^M2672,joe.bloggs@hotmail.com,known As,^M2672,joe.bloggs@hotmail.com,Start Date,01-JUN...
Thanks for the reply. The extract of the file is the one that I have enclosed. Counting, after the 5th line, there is a space after the comma. This is the way the file is generated and it shouldn't be. As the SQL code does it correctly if I run it outside of unix. I would like to get rid of the...
Hello,
I am generating a csv file via unix. The file is bening generated via Oracle SQL. The csv output for some reason has a chunk of space. I have tried using sed to remove the space but it does not work. I'm not very good with sed. Any help will be appreciated.
I have enclosed the file...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.