Sponsored Content
Top Forums Shell Programming and Scripting Store output of DB Cursor to a txt file Post 302565236 by durden_tyler on Monday 17th of October 2011 10:44:40 AM
Old 10-17-2011
Quote:
Originally Posted by naveensraj
...I am able to store the results of simple select queries to the txt file. but I am not sure how to store the values when using a cursor. I have given the sql query below. I will be executing this in a db2 database. ...
Code:
FOR CRTID AS CUR1 CURSOR FOR
 SELECT CTRCTID FROM LM_ACCT_RTRVL_RQST WHERE STATUS = 'R'
DO
SELECT A.CTRCTBALAMT,                        
       A.CTRCTEFFDATE,      
       A.CUSTSTCD,  
       B.POST_DT,                       
       B.AMOUNT,                              
       B.EFF_DT,                         
       B.EXPIR_DT,
       B.TXN_TYPE_CD
  FROM  CBSAR. SCLM9973 A, CBSAR. SCLM9967 B                    
WHERE A.CTRCTID      =  CRTID.CTRCTID  AND A.CTRCTID        =   B.CTRCT_ID
END FOR;

Maybe you could convert the query into a simple select and save it the way you do?

Code:
SELECT A.CTRCTBALAMT,
       A.CTRCTEFFDATE,
       A.CUSTSTCD,
       B.POST_DT,
       B.AMOUNT,
       B.EFF_DT,
       B.EXPIR_DT,
       B.TXN_TYPE_CD
 FROM  CBSAR.SCLM9973 A,
       CBSAR.SCLM9967 B
       (SELECT CTRCTID
          FROM LM_ACCT_RTRVL_RQST
         WHERE STATUS = 'R'
       ) CRTID
 WHERE A.CTRCTID = CRTID.CTRCTID
   AND A.CTRCTID = B.CTRCT_ID;

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

store output to a file and read from it

Hello all, I need to run snoop command for a period of time (a day) and extract remote host column from it to find out who is accessing my server. When I run the following on the command line it works snoop -port 22 | awk '{print $3}' but when I do snoop -port 22 | awk '{print $3}' | while... (2 Replies)
Discussion started by: afadaghi
2 Replies

2. Shell Programming and Scripting

How to store the sql query output into txt file?

Hi I want ot save SQL query result in one txt file. for that i have written one code line sqlplus -s $dbstring @/usr/local/bin/sched/nightly_Cronjob/exec_123.sql >> /usr/local/bin/sched/nightly_Cronjob/result.txt but it is not working . database : Oracle so please advice me how can i... (7 Replies)
Discussion started by: Himanshu_soni
7 Replies

3. Shell Programming and Scripting

Store grep output file

Hi, I'm trying to store the output from a grep, I just want the file name. But couldn't find how to do it. Basically, I just want to grep <etc> * and I want to store the file name. There is only one file with the what I'm grepping, so storing in a variable o an array its the same. If someone... (3 Replies)
Discussion started by: radicaled
3 Replies

4. Homework & Coursework Questions

man command output to a txt file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to outut the man command output into a text file which will help me for future reference. 2.... (8 Replies)
Discussion started by: hariniiyer300
8 Replies

5. UNIX for Dummies Questions & Answers

Writing a script that will take the first line from each file and store it in an output file

Hi, I have 1000 files names data1.txt through data1000.txt inside a folder. I want to write a script that will take each first line from the files and write them as output into a new file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

6. UNIX for Advanced & Expert Users

Help on Shell Scripting - to store output to a fixed file

Hi I have a file called "test.txt" and it looks like this x y z x/c y/c/b now, i want to run a command and its output will be like this x 10 y/c/b 20 z 78 -------- my requirement is, i want to add the command output to "test.txt" as like below x 10 y ... (1 Reply)
Discussion started by: siva kumar
1 Replies

7. Shell Programming and Scripting

Need to convert output.txt into html file

I have output.txt file generated through shell scripts which need convert in tabular format using html can you please help me output.txt Token State Date1 Date2 Description Name 34567 open 27/06/13 28/06/13 ... (5 Replies)
Discussion started by: vijay_rajni
5 Replies

8. Shell Programming and Scripting

Call a Perl script within a bash script and store the ouput in a .txt file

I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients). I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
Discussion started by: mecaka
6 Replies

9. Shell Programming and Scripting

Desired output.txt for reading txt file using awk?

Dear all, I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script. Any help is greatly appreciated. Greetings, emily DATA.txt (snippet of the huge text file) 407202849... (2 Replies)
Discussion started by: emily
2 Replies

10. Shell Programming and Scripting

How to store info from a txt file into a hash?

I'm trying to make a perl script using the "open" command to open and read a file, storing the information in said file into a hash structure. This is what is inside my file- Celena Standard F 01/24/94 Cancer Jeniffer Orlowski F 06/24/86 None Brent Koehler M 12/05/97 HIV Mao Schleich... (4 Replies)
Discussion started by: Eric1
4 Replies
XDefineCursor(3X11)													       XDefineCursor(3X11)

NAME
XDefineCursor, XUndefineCursor - define cursors SYNOPSIS
XDefineCursor(display, w, cursor) Display *display; Window w; Cursor cursor; XUndefineCursor(display, w) Display *display; Window w; ARGUMENTS
Specifies the cursor that is to be displayed or None. Specifies the connection to the X server. Specifies the window. DESCRIPTION
If a cursor is set, it will be used when the pointer is in the window. If the cursor is None, it is equivalent to XUndefineCursor. XDefineCursor can generate BadCursor and BadWindow errors. The XUndefineCursor function undoes the effect of a previous XDefineCursor for this window. When the pointer is in the window, the parent's cursor will now be used. On the root window, the default cursor is restored. XUndefineCursor can generate a BadWindow error. DIAGNOSTICS
The server failed to allocate the requested resource or server memory. A value for a Cursor argument does not name a defined Cursor. A value for a Window argument does not name a defined Window. SEE ALSO
XCreateFontCursor(3X11), XRecolorCursor(3X11) Xlib -- C Language X Interface XDefineCursor(3X11)
All times are GMT -4. The time now is 07:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy