Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How do I use SQL to query based off file data? Post 302329338 by whoknows on Friday 26th of June 2009 05:06:28 PM
Old 06-26-2009
Power How do I use SQL to query based off file data?

This is basically what I want to do:

I have a file that contains single lines of IDs.
I want to query the oracle database using these IDs
to get a count of which ones match a certain condition.
the basic idea is:

cat myfile |
while read id
do
$id in select count(PC.ptcpnt_id)
from ptcpnt_cmpsit PC
where
PC.gndr_type = 'F'
;
done

Hopefully, you get the gist.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unloading sql query to file

In unload to "/usr/home/data.012202" I wish to use a date variable as in unload to "/usr/home/data.`date`" for the file is that possible in a query to do, or will i need to add a mv command after the query to do it. I tried backquotes, , and () on `date` but didn't seem to work Thanks... (2 Replies)
Discussion started by: Link_02
2 Replies

2. Shell Programming and Scripting

how to use data in unix text file as input to an sql query from shell

Hi, I have data in my text file something like this. adams robert ahmed gibbs I want to use this data line by line as input to an sql query which i run by connecting to an oracle database from shell. If you have code for similar scenario , please ehlp. I want the output of the sql query... (7 Replies)
Discussion started by: rdhanek
7 Replies

3. Shell Programming and Scripting

redirecting sql query output to a file

Hi, I am executing sql files in my unix shell script. Now i want to find whether its a success or a failure record and redirect the success or failure to the respective files. meaning. success records to success.log file failure record to failure.log file. As of now i am doing like... (1 Reply)
Discussion started by: sailaja_80
1 Replies

4. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

5. Shell Programming and Scripting

Dynamic SQL query based on shell script parameters

Hi, I need a script that will run a dynamic Oracle SQL. Dynamic meaning the SQL statement depends on the parameter. For instance, something like this: #!/bin/ksh -x # Set environment . /home/mine/set_vars sqlplus $LOGINID <<! >> /home/mine/log.txt select count(1) from $1 where... (2 Replies)
Discussion started by: laiko
2 Replies

6. UNIX for Advanced & Expert Users

Output the SQL Query result to a File

Hello Guys, This message is somewhat relates with last thread. But I need to re-write thing. I start over a little. I am stuck now and need your help. Here is my script- #! /bin/ksh export ORACLE_HOME=/opt/oracle/app/oracle/product/9.2 /opt/oracle/app/oracle/product/9.2/bin/sqlplus -s... (5 Replies)
Discussion started by: thepurple
5 Replies

7. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

8. Shell Programming and Scripting

Read input file and used it to SQL query

Hi All, Seeking for your assistance to read each line $1 and $2 of input file and used it to query. Ex. file1.txt(number range) 9064500000 9064599999 9064600000 9064699999 9064700000 9064799999 Database name: ranges_log a_no message 9064500001 test 9064700000 ... (7 Replies)
Discussion started by: znesotomayor
7 Replies

9. Shell Programming and Scripting

Run sql query in shell script and output data save as delimited text

I want to run sql query in shell script and output data save as delimited text (delimited text would be comma) Code: SPOOL_FILE=/pgedw/dan.txt SQL=/pgedw/dan.sql sqlplus -s username/password@myhost:port/servicename <<EOF set head on set COLSEP , set linesize 32767 SET TRIMSPOOL ON SET... (8 Replies)
Discussion started by: Jaganjag
8 Replies

10. Programming

Need sql query to string split and normalize data

Hello gurus, I have data in one of the oracle tables as as below: Column 1 Column 2 1 NY,NJ,CA 2 US,UK, 3 AS,EU,NA fyi, Column 2 above has data delimited with a comma as shown. I need a sql query the produce the below output in two columns... (5 Replies)
Discussion started by: calredd
5 Replies
pset_ctl(2)							System Calls Manual						       pset_ctl(2)

NAME
pset_ctl() - processor set control SYNOPSIS
DESCRIPTION
The function provides a means to query the system processor set configuration and assignment information. The request argument specifies what information is needed for the pset processor set. The following request values are supported: Return the ID of the processor set binding for the calling thread. The pset and id arguments are ignored. Return the ID of the first locality domain contributing to the processor set pset. The id argument is ignored. Return the ID of the first processor in the processor set pset that is in the proximity of the processor specified by id. Even when the processor given by id is enabled, the return value will be -1 if none of the proximate processors contribute to the processor set pset. If the processor given by id is not enabled, -1 is returned. See mpctl(2) for details on proximate processors. Return the ID of the first processor set in the system. The pset and id arguments are ignored. Return the ID of the first processor in the processor set pset. It will return -1 if the processor set is empty. Any processors in the processor set that is in transition are ignored. The id argument is ignored. Return the ID of the next locality domain after the locality domain specified in id that contributes to the processor set pset. Typically, is called to determine the first locality domain in a processor set. is then called in a loop (until the call returns -1) to determine the IDs of the remaining locality domain in the processor set. Return the ID of the next processor in the processor set pset that is in the proximity of the processor specified by id. Typically, is called to determine the first proximate processor. is then called in a loop (until the call returns -1) to deter- mine the IDs of the remaining proximate processors. Return the ID of the next processor set in the system after pset. The id argument is ignored. Typically, is called to determine the first processor set. is then called in a loop (until the call returns -1) to determine the IDs of the remaining processor sets in the system. Return the ID of next processor in the processor set pset after the processor specified in id. Typically, is called to determine the first processor in a processor set. is then called in a loop (until the call returns -1) to determine the IDs of the remaining processors in the processor set. Return the number of locality domains that have at least one processor assigned to the processor set pset. The id argument is ignored. Return the number of processors assigned to the processor set pset that are in the proximity of the processor specified by id. Even when the processor given by id is enabled, the return value will be 0 if none of proximate processors contribute to the processor set pset. If the processor given by id is not enabled, -1 is returned. Return the current number of processor sets in the system. It will always be greater than or equal to one. The pset and id arguments are ignored. Return the number of processors assigned to the processor set pset. Any processors in the processor set that is in transition are not included. The id argument is ignored. Return number of processors contributed by the locality domain specified by id to the processor set pset. Return the ID of the processor set assigned for the processor specified in id. If the processor is not enabled or is in transition from one processor set to another, -1 is returned with an error. The pset argument is ignored. Logical Processor and Processor Core Information On systems with the Hyper-Threading (HT) feature enabled, each processor core may have more than one hyper-thread per physical processor core. When hyper-threading is enabled at the firmware level, each hyper-thread is represented to the operating system and applications as a logical processor (LCPU). Hence the basic unit of any topology information is a logical processor. However, some applications may want to get the system topology information at the physical processor core level. Returns the number of processor cores assigned to the processor set pset. Any processor cores in the processor set that are in transition are not included. The id argument is ignored. Returns the ID of the first processor core in the processor set pset. It will return -1 if the processor set is empty. Any processor cores in the processor set that is in transition are ignored. The id argument is ignored. Returns the ID of the next processor core in the processor set pset after the processor specified in id. Typically, is called to determine the first processor core in a processor set. is then called in a loop (until the call returns -1) to determine the IDs of remaining processor cores in the processor set. Returns the number of enabled processor cores assigned to the processor set pset. Any user may query the system processor set topology using the function. Use with name to see if the processor set functionality is supported by the underlying HP-UX operating system version. RETURN VALUE
returns a value based on on successful completion. Success. The value is based on the request. Failure. is set to indicate the error. ERRORS
sets to one of the following values if the corresponding condition is detected. The request is invalid. The specified processor set pset, or the processor or the locality domain specified by id is invalid. The request is and there is no other processor set after pset, or the request is and there is no other processor after id in pset, or the request is and there is no other locality domain after id in pset, or the request is and there is no other proxi- mate processor after id in pset. The request is or and the processor specified by id is not enabled. The processor set functionality is not supported by the underlying HP-UX version. EXAMPLES
Get total count and IDs of all processor sets in the system. AUTHOR
was developed by HP. SEE ALSO
psrset(1M), mpctl(2), pset_assign(2), pset_bind(2), pset_create(2), pset_destroy(2), pset_getattr(2), pset_setattr(2), sysconf(2), privi- leges(5). pset_ctl(2)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy