Sponsored Content
Top Forums Shell Programming and Scripting Passing variable from file to sql from script Post 302923570 by Ditto on Monday 3rd of November 2014 03:44:27 PM
Old 11-03-2014
Quote:
Originally Posted by pallvi_mahajan
but how i can call this in .sql, how $filecount replace in .sql file
Code:
select * from tablename where acc in (
45456546456, 45464564565, 67854353454, 67657612132)

how are you trying to use it?
That sql you provided doesn't have any "line counts" .. so where do you want to use the line count in that query ?

[edit]
oh wait ..

just noticed you changed your question part way through and I missed it Smilie

Quote:
where acc in ( all records which are in acc.txt)
that gets a lot trickier ... Smilie

I'd probably use an external table pointing to the file, then just join with that table ... Are you using ORACLE ? or some other DB ? External tables are Oracle, other DB may have other tools for loading/peeking into files ...

[/edit]
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing PL/SQL variable value to Shell Varible

Hi my UNIX Friends, Im calling some SQL scripts through Unix Shell scripting. How do I export the value of PL/SQL variable value into a Unix shell script variable? Also could any one inform me about the 'search' and 'cut' utility of PL/SQL (like 'grep' and 'cut' in Shell scripting). ... (10 Replies)
Discussion started by: ganapati
10 Replies

2. UNIX for Advanced & Expert Users

passing value to a variable in a SQL

Hi Folks, This is a small chunk of the bigger problem which i am facing and some help here will help me resolve the rest of the issue. Problem is that i need to pass the value of a variable from a shell script to a SQL query (infact a lot of SQL's) i have the following solution but somehow... (4 Replies)
Discussion started by: kamitsin
4 Replies

3. Shell Programming and Scripting

Passing argumnets from shell script to sql

hi I all , I have sql statment in my shell script , I pass two argument to the script I need to pass the this two arguments to the sql statment example : runsql.sh "1" "2" sql : updat tables_x set y=0 where A=:x should subsituted by "1" and B=:y shuold subsituted bt "2"... (1 Reply)
Discussion started by: habuzahra
1 Replies

4. Shell Programming and Scripting

passing arguments to sql script

Hi Gurus, i have one requirement in unix script, i have a file called abc.txt in that few lines are there with the empid, i need to read each line and pass to .sql script. ex: abc.txt 2345 2346 1243 1234 i need to pass these arguments to .sql script rom unix ex: select * from... (1 Reply)
Discussion started by: Devendar
1 Replies

5. UNIX for Advanced & Expert Users

Passing Hash variable in to sql query in perl

Hi Everyone, Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below i have defined two Hash %lc and %tab as below $lc{'REFF'}='V_RES_CLASS'; $lc{'CALE'}='V_CAP_CLASS'; $lc{'XRPD'}='V_XFMR_CLASS'; $tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
Discussion started by: jam_prasanna
6 Replies

6. Shell Programming and Scripting

Replace a var in sql file with shell script variable

I have a requirement where i have a sql file (filetext.sql). This file contains a variable ss_code. Now in a shell script im trying to replace the variable ss_code with a value contained in the shell script variable MTK_DC..tried the below in the script MTK_DC="mit,cit,bit" OUT=`awk -v... (4 Replies)
Discussion started by: michaelrozar17
4 Replies

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

8. Shell Programming and Scripting

Passing a string variable from Unix to Sql Plus

Hi Guys, I am trying to pass a string variable from Unix shell script to sqlplus as a parameter. I have tried using single quotes with the variable name but it does not work. Please help me with it. I am using BASH. My code: Your help is much appreciated. Thanks, shil (2 Replies)
Discussion started by: infintenumbers
2 Replies

9. Shell Programming and Scripting

Passing variable to sql

How to pass variable to sql file. Im tryin in two ways, Method 1: my.sql select * from table where col1 = '$1' and col2 = 'text'; Method 1execute: dbaccess database my.sql $var Method2: select * from table col1 in (`cat inputfile`) and col2 = 'text'; method... (2 Replies)
Discussion started by: Roozo
2 Replies

10. Shell Programming and Scripting

Passing string from SQL to a BASH script

OS Solaris 10, DB oracle 10g Hello, We currently have a BASH script that runs and moves image files from a remote server to the local db server. A snippet of the code shows that we are picking up all Images that are 'mtime -1' some code... for file in `ssh user@10.200.200.10 'find... (3 Replies)
Discussion started by: JonP
3 Replies
IDFETCH(1)						     NCBI Tools User's Manual							IDFETCH(1)

NAME
idfetch - retrieve biological data from the NCBI ID1 server SYNOPSIS
idfetch [-] [-F str] [-G filename] [-Q filename] [-c N] [-d str] [-e N] [-f str] [-g N] [-i N] [-l filename] [-n] [-o filename] [-q str] [-s str] [-t N] DESCRIPTION
idfetch is a client for NCBI's ID1 server, which contains a large database of annotated biological sequences. OPTIONS
A summary of options is included below. - Print usage message -F str Add the specified feature types (comma-delimited); allowed values are CDD, SNP, SNP_graph, MGC, HPRD, STS, tRNA, and microRNA. -G filename File with list of GIs, (versioned) accessions, FASTA SeqIDs to dump -Q filename Generate GI list by Entrez query in filename; requires -dn or -dp. -c N Max complexity: 0 get the whole blob (default) 1 get the bioseq of interest 2 get the minimal bioseq-set containing the bioseq of interest 3 get the minimal nuc-prot containing the bioseq of interest 4 get the minimal pub-set containing the bioseq of interest -d str Database to use (with -q, can be either n for nucleotides or p for proteins). -e N Entity number (retrieval number) to dump -f str Flattened SeqId. Possible formats: type([name][,[accession][,[release][,version]]]) as '5(HUMHBB)' type=accession type:number (type is a number indicating the ASN.1 Seq-id subtype.) -g N GI id for single Entity to dump -i N Type of lookup: 0 get Seq-entry (default) 1 get GI state (output to stderr) 2 get SeqIds 3 get GI history (sequence change only) 4 get revision history (any change to ASN.1) -l filename Log file -n Output only the list of GIs (with -q and -Q). -o filename Filename for output (default = stdout) -q str Generate gi list by Entrez query. Requires -dn or -dp. -s str FASTA style SeqId ENCLOSED IN QUOTES. Formats: lcl|int or str bbs|int bbm|int gb|acc|loc emb|acc|loc pir|acc|name sp|acc|name pat|country|patent|seq gi|int dbj|acc|loc prf|acc|name pdb|entry|chain -t N Output type: 1 text ASN.1 (default) 2 binary ASN.1 3 GenBank (Seq-entry only) 4 GenPept (Seq-entry only) 5 FASTA (table for history) 6 quality scores (Seq-entry only) 7 Entrez DocSums 8 FASTA reverse complement AUTHOR
The National Center for Biotechnology Information. NCBI
2011-09-02 IDFETCH(1)
All times are GMT -4. The time now is 06:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy