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
cdk_position(3) 					     Library Functions Manual						   cdk_position(3)

NAME
cdk_position - curses widget positioning key-bindings SYNOPSIS
Position methods for the Cdk widgets allow the user to move the widget around the screen via the cursor/keypad keys. DESCRIPTION
The following key bindings can be used to move the widget around the screen. +---------------------------------------------------------------+ |Key Action | +---------------------------------------------------------------+ |Up Arrow Moves the widget up one row. | |Down Arrow Moves the widget down one row. | |Left Arrow Moves the widget left one column | |Right Arrow Moves the widget right one column | |1 Moves the widget down one row and left one | | column. | |2 Moves the widget down one row. | |3 Moves the widget down one row and right one | | column. | |4 Moves the widget left one column | |5 Centers the widget both vertically and hori- | | zontally. | |6 Moves the widget right one column | |7 Moves the widget up one row and left one | | column. | |8 Moves the widget up one row. | |9 Moves the widget up one row and right one | | column. | |t Moves the widget to the top of the screen. | |b Moves the widget to the bottom of the | | screen. | |l Moves the widget to the left of the screen. | |r Moves the widget to the right of the screen. | |c Centers the widget between the left and | | right of the window. | |C Centers the widget between the top and bot- | | tom of the window. | |Escape Returns the widget to its original position. | |Return Exits the function and leaves the wid- | | getwhere it was. | +---------------------------------------------------------------+ +---------------------------------------------------------------+ The numbers 0-9 are chosen to correspond to the numeric keypad on your terminal. Cdk does not handle the application mode keypad control sequences, since those are not defined via terminfo. To use the numeric keypad you should ensure that it is in normal (or NumLock) mode. SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3) cdk_position(3)
All times are GMT -4. The time now is 05:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy