Sponsored Content
Top Forums Shell Programming and Scripting Regarding file input to SQL from command line Post 302961442 by Showdown on Sunday 29th of November 2015 11:38:02 AM
Old 11-29-2015
Oracle Regarding file input to SQL from command line

Hi friends,

Need your help again to get a best approach for the below scenario.

I am previously having one shell script which accepts request_id/s as the command line argument.
single req_id arg= 1111
Multiple arg= 1111,2222,3333

which gets passed to the embedded sql inside to the in operator to update the status to inactive

Pseudo code for the same : (please ignore syntax error)

Code:
#! /bin/bash
set -vx

req_ids=$1

sqlplus -s xxxx/yyyy@zzzz  << EOF >> /grs/sql_logs
update table_name  set status='INACTIVE' where req_id in ($req_ids);
commit;
exit;
EOF

The above method was working like a charm for some small set of request_ids.
As presently I am getting a huge volume of request_ids(~1200) I fear whether the command line argument will allow a string of 5000bytes.
If at all it allows the in operator will not allow > 2499 bytes of data.

I have tried inserting the record into a temp table and run a for loop in sql but can't as i am not privileged to create temp table in prod env.
Also tried to pass the file as the command line (.csv file) argument then split the file into 300 records each by pivoting using awk command and process one by one file and remove them once processed but still restricted to create temp files in prod box.

Can you please focus some idea to deal with this situation without using temporary table and split method.

Many Thanks to all the members and UNIX.com
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED + Regex + SQL Input file

Here's the problem... I have a mysqldump file and I need to put single quotes around the date/time timestamp. So for example I have a line like: INSERT INTO attachments VALUES (1,182,2004-08-06 09:24:04,'description'... and I need it to become INSERT INTO attachments VALUES... (10 Replies)
Discussion started by: primal
10 Replies

2. Shell Programming and Scripting

isql input file with multiple sql statements

I've got: isql -U $USERID -S $SERVER -D $DATABASE -i inputfile.sql -o outputfile.txt in inputfile I have: go sql#1 go sql#2 go sql#3 go I also tried without "go" and with";" instead which did not work SQL statements will work if I paste them directly into the script and use EOF ... (0 Replies)
Discussion started by: Cailet
0 Replies

3. 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

4. Shell Programming and Scripting

SQL PLUS Command 'ACCEPT' is not waiting for user input with sh shell script

Dear All, The sqlplus 'Accept' command is not waiting for user input when I include the command within a shell script. Note: The 'Accept' command is working fine if I execute it in a SQLPLUS Prompt. Please fins the below sample script which i tried. SCRIPT: -------- #!... (4 Replies)
Discussion started by: little_wonder
4 Replies

5. UNIX for Dummies Questions & Answers

Bash script to delete file input on command line

1) I wrote a script and gave the desired permissions using "chmod 755 scriptname". Now if i edit the script file, why do i need to set the permission again? Didn't i set the permission attribute.. or if i edit the file, does the inode number of file changes? 2) I am running my unix on a server... (1 Reply)
Discussion started by: animesharma
1 Replies

6. UNIX for Dummies Questions & Answers

SQL Script to use variable value from input file

Here is the requirement, When I run the "run file KSH (sql)", it should substitute '${pCW_Bgn_DT}' with 201120 and '${pCW_End_DT}' with 201124 Input File ---------- $ cat prevwk.dat 201124 20110711 run file KSH (sql) ------------------ In this file, I want to use the variables... (1 Reply)
Discussion started by: shanrice
1 Replies

7. Shell Programming and Scripting

Need help to run sql query from a script..which takes input from a file

I need to run sql script from shell script which takes the input from a file and contents of file will be like : 12345 34567 78657 and query will be like : select seq_nbr from bus_event where event_nbr='12345'; select seq_nbr from bus_event where event_nbr='34567'; select seq_nbr... (1 Reply)
Discussion started by: rkrish
1 Replies

8. Shell Programming and Scripting

Read input file with in awk script not through command line

Hi All, Do we know how to read input file within awk script and send output toanother log file. All this needs to be in awk script, not in command line. I am running this awk through crontab. Cat my.awk #!/bin/awk -f function test(var){ some code} { } END { print"test code" } (5 Replies)
Discussion started by: random_thoughts
5 Replies

9. Shell Programming and Scripting

Pass command line arg to sql file

Hi all, How to pass the command line argument to a sql file Script: #!/bin/ksh if ] ; then test.sql fi My Sql Informix DB: echo "select * from table where col1 = 2234 and col2 = '$3'"|dbaccess ddname But im getting `:' unexpected error (5 Replies)
Discussion started by: Roozo
5 Replies

10. 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
tpm_setactive(8)					      System Manager's Manual						  tpm_setactive(8)

							  TPM Management - tpm_setactive

NAME
tpm_setactive - change TPM active states SYNOPSIS
tpm_setactive [OPTION] DESCRIPTION
tpm_setactive reports the status of the TPM's flags regarding the active state of the TPM. This is the default behavior and also accessible via the --status option. Requesting a report of this status prompts for the owner password. The --active option changes the TPM to the active state (via the TPM_PhysicalSetDeactivated API). This operation requires evidence of physical presence, is persistent and requires a reboot to take effect. The --inactive option (via the TPM_PhysicalSetDeactivated API) changes the TPM to the inactive state. This operation requires evidence of physical presence, is persistent and requires a reboot to take effect. An inactive TPM is essentially off but still allows for a tpm_takeownership to occur. The --temp option causes deactivation (via the TPM_SetTempDeactivated API) to happen immediately but only endure for the current boot cycle. The --status, --active, --inactive, and --temp options are mutually exclusive and the last one on the command line will be carried out. -h, --help Display command usage info. -v, --version Display command version info. -l, --log [none|error|info|debug] Set logging level. -u, --unicode Use TSS UNICODE encoding for passwords to comply with applications using TSS popup boxes -s, --status Report the status of flags regarding the TPM active states. -a, --active Make the TPM active. Operation is persistent, requires phyiscal presence to authorize, and a reboot to take effect. -i, --inactive Make the TPM inactive. Operation is persistent, requires phyiscal presence to authorize, and a reboot to take effect. -t, --temp Makes the TPM inactive for the current boot cycle only. -z, --well-known Authenticate using 20 bytes of zeros as owner password (the default TSS Well Known Secret), instead of prompting for an owner password. SEE ALSO
tpm_version(1), tpm_setpresence(8), tpm_takeownership(8), tpm_setenable(8), tcsd(8) REPORTING BUGS
Report bugs to <trousers-users@lists.sourceforge.net> TPM Management 2005-05-06 tpm_setactive(8)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy