substitute variable for values in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting substitute variable for values in perl
# 1  
Old 01-23-2011
substitute variable for values in perl

hi all,
how do i assign values passed in from command line to and sql statement in perl ?? e.g

i want to assign :name1 and :Name2 to be whatever is passed into the perl script command line

Code:
my $sqlStr = "select * from test_table where column1 = upper(nvl(:name1, name1 ))   and column2 = upper(nvl(:name2, name2))


thanks in advance.
# 2  
Old 01-24-2011
$ARGV[0] is the first command-line parameter, $ARGV[1] is the second, and so on.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Substitute variable inside nawk

Hi, I need to set "prd" in the below command to a unix variable nawk '/^#/ {next} FNR==NR {prd;next} !($0 in prd)' So, this is what i did fname=prd // unix shell variable nawk -v fname=$fname '/^#/ {next} FNR==NR {fname;next} !($0 in fname)'But the value of fname i.e "prd" is not... (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Shell Programming and Scripting

PERL - Variable values getting mixed up!

Hi, I only dip my toe into PERL programming on the odd ocassion so I was wondering if anyone had any ideas as to why the below is happening: When I run my PERL script the variable values seem to get mixed up. my $fileName = basename($maxFile,".TXT"); my $currentSeqNum =... (2 Replies)
Discussion started by: chris01010
2 Replies

3. Shell Programming and Scripting

Extract values from Perl variable

Hi Guys, I am stuck in a problem. I have a variable in Perl script which has value for example X=a-b-c; Now, I want to extract a b c separately into different 3 variables. I know this can be done in shell using awk but Perl behaves a bit different. Can anybody help me on this please?... (3 Replies)
Discussion started by: prashant2507198
3 Replies

4. Shell Programming and Scripting

AWK variable substitute issue

dear, I have below file called folderlist.txt # ParentFolder environment_flag SubFolders triss 1 checksum bookstructure 1 fx 1 checksum_GMDB I have a script which which will create the folders under... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

5. Shell Programming and Scripting

substitute variable in bash

hi all, Assume that i a having the following three lines in an executable file #/bin/bash a=Tue Tue=1 When i give echo $a the value should be 1, how to do this. Your suggestions please. Thanks in advance, Anish (4 Replies)
Discussion started by: anishkumarv
4 Replies

6. Shell Programming and Scripting

Substitute Perl Script

I am having trouble with a part of my substitute script I am using. I have it look through a file and find an exact match and then if it finds that match in the 1 file it should run the following 1 liner on 3 different files. perl -pi -e 's/$CurrentName\s/$NewName/g' foo.cfg; The issue that is... (8 Replies)
Discussion started by: Takau
8 Replies

7. Shell Programming and Scripting

Using Awk to efficiently substitute values using 3 vectors

I'm trying to efficiently combine the fields of two vectors (vectors b and c) into a new vector (vector d) as defined by instructions from a 3rd vector (vector a). So vector a has either a 1 or 2 in each field specifying which vector (b or c respectively) should go into that field. Vector a is... (4 Replies)
Discussion started by: LaTortuga
4 Replies

8. Linux

How to store values into variable in perl

Hi, Can you please help me of how to store the values into variables. Here is the output in LINUX for the below command. $free output : total used free Mem: 3079276 3059328 19948 Swap: 1023992 6324 1017668 ... (3 Replies)
Discussion started by: chittiprasad15
3 Replies

9. UNIX for Dummies Questions & Answers

Substitute Variable

Can anyone tell me what is the purpose of a substitute variable in the unix programming language and give an example where it may be used? Thanks! (0 Replies)
Discussion started by: mmg2711
0 Replies

10. Shell Programming and Scripting

Substitute variable values

Hi, I am trying to redefine the value of a variable based on another variable value. And I want to read in my variables from a enviroment file in the end -- at least I think so. But 1st here's what I want I need to get working: var_1="11 10 9 8 7 6 5 4 3 2 1" var_2=3 var_3=4 So I want... (12 Replies)
Discussion started by: John Rihn
12 Replies
Login or Register to Ask a Question