I need to query a table ,retrieve two columns of info in multiple rows. I need to parse through each row after finding out how many rows are there and extract the column data and store it in a vcariable. For example , if there are 5 rows of information

For i=0 to 5

do

Get row of ouput from isql

$lname$i=<extract first column>

$fname$i=<extract second column>

Go to next row of output from isql

done

These variables i use to query database in later part of the script.

Is it possible? I have done it in ksh but am very new to perl.

I know how to open a file,write query to it and execute using isql through perl. I just dont know how to implement the above pseudo code.

Can somebody please help??

Thanks..

I'm afraid i have no idea what DBI is but i guess its sort of extension to perl that i need to install. I cant be sure that i can get it installed in customer place. But normal isql seems to solve my problem.

After getting these data i need to create a view on sybase server and then bcp out the data. I have written the perl script for it and it is working fine but for a fixed number of inputs.

The fname,lname form part of the WHERE clause of the query. How can i write SQL statement to create view with variable number of conditions in WHERE clause

CREATE VIEW cust_view AS select * from customer where fname='AAAA' AND fname='BBBB' AND ...

How do i handle this assuming i have all the 'fnames' in an array and so know the count of array elements.??


In reply to how to parse output from isql utility by reuben12

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.