RE: is there any way to pass the UNIX variable to SQL *Loader.

RE: is there any way to pass the UNIX variable to SQL *Loader.

 

  

I've written a perl script that creates a file with a series of inserts
and updates, i then run that from the sql prompt.

#!/usr/bin/perl -w

$out = "/home/prod/created_update.sql";

open (FH, "/home/prod/edward.csv") or die "unable to open file";
open (FG, ">> $out") or die "unable to open file $out";

while (<FH>) {
$count++ if (/^(.*),(.*),$/i);
$line = "update TAFUSR SET BEM_VIA_EMAIL = '1' where USR = '$1';"; #
creates sql!
print FG $line,"\n\n";
}

system "chmod 777 $out";
system "chown prod:prod $out";
(-e $out) ? print "$out has been created with $count rows\n" : print
"file $out has NOT been created\n";

hope this helps

-----Original Message-----
From: Pitchai Siva (GE Infra Energy Non-GE)
[mailto:oracledba-ezmlmshield-x6879626.[Email address protected]
Sent: 31 March 2008 10:55
To: LazyDBA Discussion
Subject: is there any way to pass the UNIX variable to SQL *Loader.

Hi all,



I've created one shell script it's called the sql loader for load the
flat file into DB table. The flat file has been created by UNIX shell
script.

I wanted to pass the UNIX current directory to the sql loader (I have
assigned the current DIR into one variable) so I want to pass the
variable to sql loader. How can I do it...?







Thanks and regards,

Siva.P

Bangalore





---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




--------------------------------------------------------------------------------------------------------------------
'This email and any files transmitted with it are confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email in error please notify the system manager. Please
note that any views or opinions presented in this email are solely those of the author and do not necessarily
represent those of the Council. Finally, the recipient should check this email and any attachments for the presence
of viruses. The Council accepts no liability for any damage caused by any virus transmitted by this email.'

'Mae'r e-bost yma ag unrhyw ffeiliau trosglwyddwyd ynddi yn gyfrinachol ar gyfer defnydd yr unigolyn neu'r sefydliad
cyfeiriwyd ati yn unig. Os ydych wedi derbyn yr e-bost yma mewn camgymeriad rhowch wybod i reolwr eich system.
Nodwch taw unrhyw sylwadau neu farn soniwyd amdanynt yn yr e-bost yma ydi sylwadau a barn yr awdur ac nid yn
angenrheidiol yn cynrychioli rhai'r Cyngor. I orffen, dylid y person sy'n derbyn yr e-bost sicrhau nad oes firws
ynddi nac mewn unrhyw ddogfen sydd ynghlwm i'r e-bost. Nid yw'r Cyngor yn derbyn unrhyw gyfrifoldeb am unrhyw ddifrod
achoswyd gan unrhyw firws trosglwyddwyd gan yr e-bost yma.'


Oracle LazyDBA home page