Hello Monks,
I'm a newbie to perl and I was wondering if the following code written in sqlplus can be translated to perl. If someone could, please help me out.
sqlplus $connect_string << end > bilevel.tmp
set serveroutput on size 100000;
set pagesize 1000
set linesize 140
set heading off
set feedback off
set trims on
DECLARE
num number := 0;
state0 varchar(8) := '^%^%^%';
state1 varchar(8) := '^%^%^%';
mod_meas_name varchar(12);
CURSOR c1 IS
SELECT distinct icd_meas.meas_name, icd_meas.meas_title
FROM icd_meas, icd_cal_discrete
WHERE icd_meas.meas_name = icd_cal_discrete.meas_name
and data_type = 'DIS' and size_bits_no = 1;
BEGIN
dbms_output.put_line('BiLevel Discrete Commands');
FOR record in c1 LOOP
num := num + 1;
BEGIN
SELECT state into state0
FROM icd_cal_discrete
WHERE record.meas_name = meas_name
and high_count_no = 0;
SELECT state into state1
FROM icd_cal_discrete
WHERE record.meas_name = meas_name
and high_count_no = 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
state0 := '';
state1 := '';
WHEN TOO_MANY_ROWS THEN
state0 := '--';
state1 := '--';
END;
dbms_output.put_line('!!DESCRIPTION: ' || record.meas_title);
dbms_output.put_line('ID;B;' || rpad(replace(record.meas_name,'_'),12) ||
';' || rpad(state1,8) || ';' || rpad(state0,8));
END LOOP;
-- dbms_output.put_line('num = ' || num);
END;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.