Hi,
I did struggle quite a while to get this right but am again
back to where i started from. I am still unable to get
this work. I am warned of printing on closed file handle. I am not sure how to resolve it.
Below is the code that I am using
Any suggestions?
#!/usr/bin/perl # Initialize Server Specific Variables $server = <STDIN>; $user = <STDIN>; $password = <STDIN>; $omnihome = "/app/netcool/omnibus"; # Initialize Variables that define SQL Login Commands $sqsh_string = "${omnihome}/bin/nco_sql.sqsh -server $server -user $us +er -password $password"; #---------------------------------------------------------- # Script Body #---------------------------------------------------------- #$running = `$test`; # Initialize SQL Action Statements $sql_select_Procedure = "select ProcedureName, SQLBlock from persist.p +rocedures"; # Select ProcedureName and SQLBLock &GetRawProcedureData; %val = split(/_yvs_kj_/, $raw_data); while (($name, $code) = each (%val)) { open (FILE, $name) or die ("jhand"); print FILE $code; print "$name\n"; print "$code\n"; } close FILE; #---------------------------------------------------------- # Subroutines #---------------------------------------------------------- sub GetRawProcedureData { $raw_data = `$sqsh_string <<'EOF'; $sql_select_Procedure go quit EOF`; }
This is the output of my sql query
output from query script: send_email_yvs_kj_ create or replace procedure send_email (in node character(1), in sever +ity integer, in subject character(1), in email character(1), in summa +ry character(1), in hostname character(1)) executable '$OMNIHOME/util +s/nco_mail' host hostname user 0 group 0 arguments '\''+node+'\'', se +verity,'\''+subject+'\'','\''+email+'\'','\''+summary+'\'';_yvs_kj_ jinsert_yvs_kj_ create or replace procedure jinsert( in serial int, in uid int, in t +stamp utc, in msg char(4080) )begin---- Procedure inserts a record i +nto the alerts.journal table. Automations that -- require journal ent +ries should execute this procedure.---- Usage: -- call procedure ji +nsert( old.Serial, %user.user_id, getdate, 'This is my journal entry' +);-- insert into alerts.journal values ( journal_keyfie +ld( to_int( serial ), to_int( uid ), tstamp ), -- KeyField + serial, -- Serial uid, + -- UID tstamp, + -- Chrono split_multibyte(msg, 1, 255), -- + Text1 split_multibyte(msg, 2, 255), -- Text2 + split_multibyte(msg, 3, 255), -- Text3 spli +t_multibyte(msg, 4, 255), -- Text4 split_multibyte(m +sg, 5, 255), -- Text5 split_multibyte(msg, 6, 255), + -- Text6 split_multibyte(msg, 7, 255), -- Text7 + split_multibyte(msg, 8, 255), -- Text8 + split_multibyte(msg, 9, 255), -- Text9 split_multi +byte(msg, 10, 255), -- Text10 split_multibyte(msg, 11 +, 255), -- Text11 split_multibyte(msg, 12, 255), -- +Text12 split_multibyte(msg, 13, 255), -- Text13 + split_multibyte(msg, 14, 255), -- Text14 sp +lit_multibyte(msg, 15, 255), -- Text15 split_multibyt +e(msg, 16, 255) -- Text16 );end_yvs_kj_ convert_severity_yvs_kj_ create or replace procedure convert_severity (IN omnibus_severity INTEGER, OUT tec_severity INTEGER) BEGIN if (omnibus_severity = 5) then set tec_severity = 50 elseif (omnibus_severity = 4) then set tec_severity = 40 elseif (omnibus_severity = 3) then set tec_severity = 40 elseif (omnibus_severity = 2) then set tec_severity = 30 elseif (omnibus_severity = 1) then set tec_severity = 10 else set tec_severity = 10 end if; END_yvs_kj_
In reply to Re^4: export table to text.
by kirtivardhan
in thread export table to text.
by kirtivardhan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |