Sponsored Content
Top Forums Shell Programming and Scripting Reading data from DataBase and Writing to a file Post 302369545 by rajeshorpu on Monday 9th of November 2009 02:38:06 AM
Old 11-09-2009
Reading data from DataBase and Writing to a file

Hi All,

Please help me in writing data to a file in one row.

In database there is a column which contains large data which does not fit in the file in one row. The column contains list of paths. I want to write these paths to a file in one row.

Please find the code below writes :

Code:
sqlplus -s $DBCredentials  1> $myJobTaskAttribListFile   <<-EndOFSQL
 SET DEFINE OFF;
 SET SERVEROUT ON
 SET LINESIZE 3400;
 DECLARE
  i_job_id      NUMBER := $myJobId ;
  o_run_status_id    NUMBER := 0 ;
  i_end_time          VARCHAR2(1000) ;
  i_total_errors      NUMBER := 0 ;
  i_total_warnings    VARCHAR2(1000) ;
  i_total_inserted    NUMBER := 0 ;
  i_total_updated     NUMBER := 0 ;
  i_total_rejected    NUMBER := 0 ;
  i_log_file          VARCHAR2(1000) ;
  i_job_run_message   VARCHAR2(512) ;
  i_modlast_by        VARCHAR2(1000) ;
  o_sqlcode          NUMBER := 0 ;
  o_sqlmsg       VARCHAR2(1000) ;
 BEGIN
  $myUSPLoadJobTaskAttribs
  (
   i_job_id,
   o_run_status_id,
   o_sqlcode,
   o_sqlmsg 
  );
  
 END; 
 /
 EndOFSQL

I am getting Output as fallows..

Code:
1=XP|classpath|/usr/home/dfusr/lib/xalan.jar:
/usr/home/dfusr/lib/xerces.jar:
/usr/home/dfusr/lib/xml.jar:
/usr/home/dfusr/lib/classes12.zip:
/usr/home/dfusr/lib/DataFeed.jar:
/usr/home/dfusr/lib/pedf/MeetingAlertEmail.jar:
/usr/home/dfusr/lib/mailapi.jar:
/usr/home/dfusr/lib/pop3.jar:
/usr/home/dfusr/lib/activation.jar:
/usr/home/dfusr/lib/smtp.jar:
/usr/home/dfusr/lib/ADPModel.jar:
/usr/home/dfusr/lib/ADPUtil.jar:
/usr/home/dfusr/lib/ServiceLocator.jar:
/usr/home/dfusr/lib/log4j-1.2.8.jar:
/usr/home/dfusr/lib/toplink.jar:
/usr/home/dfusr/lib/xmlparserv2.jar

I want to write all the paths (at max 20) in one row as fallows.

Code:
1=Java|classpath|/usr/home/dfusr/lib/xalan.jar:/usr/home/dfusr/lib/xerces.jar:/usr/home/dfusr/lib/xmlparserv2.jar

Please help me in this regards

I set the LINESIZE of 3400 as above under sql but it not working


Thanks-
Rajesh

Last edited by Franklin52; 11-09-2009 at 07:44 AM.. Reason: Please use code tags!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

writing database tables into a file in unix

I want to collect the database tables(Ex: Emp,Sal,Bonus...etc) in a file & give this file at the command prompt, when prompted for the tables list at command prompt. How can i do that ? Ex:- Import jason/jason1 tables=emp,sal,bonus log=j1.log i want to change this into Ex:- Import... (3 Replies)
Discussion started by: dreams5617
3 Replies

2. Programming

Reading and Writing file on LAN

Hi gurus I am not a C programmer but I need to read and write files on a computer on LAN using IP address. Suppose on a computer that has an IP 192.168.0.2 Any help or code example. I did in JAVA using URL, but do not know how to do in ANSI-C. In java: ------- URL url = new... (3 Replies)
Discussion started by: lucky001
3 Replies

3. Shell Programming and Scripting

writing script file for database

how to disable a constraint type of a field (present in diffrent tables) in the database unix a unix script file.. (3 Replies)
Discussion started by: shaksing
3 Replies

4. UNIX for Dummies Questions & Answers

reading ,writing,appending ,manipulating a file.

Hi my prob statement is to create a new file or to append to the 1tst file the followign chages. File 1: txt file. portfolio No a b c d abc 1 Any Any Any charString cds 2 values values values charString efd 3 can can can charString fdg 4 come come come charString... (4 Replies)
Discussion started by: szchmaltz
4 Replies

5. Shell Programming and Scripting

how to insert data into database by reading it from a text file??

Hi....can you guys help me out in this script?? Below is a text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (4 Replies)
Discussion started by: pallavishetty
4 Replies

6. UNIX for Dummies Questions & Answers

Log File Writing and Reading

Hi all, I have the following shell script code which tries to sftp and writes the log into the log file. TestConnection () { echo 'Connection to ' $DESTUSERNAME@$DESTHOSTNAME $SETDEBUG if ]; then rm $SCRIPT ; fi touch $SCRIPT echo "cd" $REMOTEDIR >> $SCRIPT echo "quit" >>... (10 Replies)
Discussion started by: valluvan
10 Replies

7. Programming

I need help with file reading/writing in C

Hello everybody, I'm trying to code a program which makes the following: It sends an ARP request frame and when it gets the reply, extracts the IP address of source and writes it to a .txt file. This is gonna be done with many hosts (with a for() loop), so, the text file would look like... (2 Replies)
Discussion started by: Zykl0n-B
2 Replies

8. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

9. UNIX for Dummies Questions & Answers

Reading and writing data to and from multiple files

Hi, I have several text files. One main file contains the detail data, other have some information to extract data from the main file, and some are empty files. Examples are shown below: The main file look like: MainFile.txt >Header1 data1...data1... >Header2 data2...data2... ... ...... (2 Replies)
Discussion started by: Fahmida
2 Replies

10. Shell Programming and Scripting

Reading and writing in same file

Hi All, Here is my requirement. I am grepping through the log files and cutting some fields from the file to generate a csv file. Now I have to check if 2nd field is having some fixed value then with the help of 4th field I have to look in same log and run another grep command to retrieve the... (11 Replies)
Discussion started by: kmajumder
11 Replies
PSC(1)							      General Commands Manual							    PSC(1)

NAME
psc - prepare sc files SYNOPSIS
psc [-fLkrSPv] [-s cell] [-R n] [-C n] [-n n] [-d c] DESCRIPTION
Psc is used to prepare data for input to the spreadsheet calculator sc(1). It accepts normal ascii data on standard input. Standard out- put is a sc file. With no options, psc starts the spreadsheet in cell A0. Strings are right justified. All data on a line is entered on the same row; new input lines cause the output row number to increment by one. The default delimiters are tab and space. The column for- mats are set to one larger than the number of columns required to hold the largest value in the column. OPTIONS
-f Omit column width calculations. This option is for preparing data to be merged with an existing spreadsheet. If the option is not specified, the column widths calculated for the data read by psc will override those already set in the existing spreadsheet. -L Left justify strings. -k Keep all delimiters. This option causes the output cell to change on each new delimiter encountered in the input stream. The default action is to condense multiple delimiters to one, so that the cell only changes once per input data item. -r Output the data by row first then column. For input consisting of a single column, this option will result in output of one row with multiple columns instead of a single column spreadsheet. -s cell Start the top left corner of the spreadsheet in cell. For example, -s B33 will arrange the output data so that the spreadsheet starts in column B, row 33. -R n Increment by n on each new output row. -C n Increment by n on each new output column. -n n Output n rows before advancing to the next column. This option is used when the input is arranged in a single column and the spreadsheet is to have multiple columns, each of which is to be length n. -d c Use the single character c as the delimiter between input fields. -P Plain numbers only. A field is a number only when there is no imbedded [-+eE]. -S All numbers are strings. -v Print the version of psc SEE ALSO
sc(1) AUTHOR
Robert Bond PSC 7.16 19 September 2002 PSC(1)
All times are GMT -4. The time now is 04:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy