Operating System - HP-UX
1752802 Members
5947 Online
108789 Solutions
New Discussion юеВ

SQL wrapper script question

 
SOLVED
Go to solution
Allanm
Super Advisor

SQL wrapper script question

I created a sql wrapper script which is doing a select statement on a set of data in a for loop.

The problem is that the select statement returns a truncated view(specially member name) of the output, can this be un-truncated.

Please find the script attached.

Thanks,
Allan
4 REPLIES 4
Patrick Wallek
Honored Contributor

Re: SQL wrapper script question

Can you post a piece of what is returned?

Perhaps you need to set some formats for the columns in your select.
Allanm
Super Advisor

Re: SQL wrapper script question

I would like to rephrase this again... the problem lies not with the sql part but with the for loop itself.

The file from which the for loop is picking up entries has spaces and its picking up entries based on the spaces and not carriage return as I would like.

Is there a solution to this problem.

BTW the enties are like this -

Allan M
...

so it taking Allan as one entry and M as another entry and I would rather want the value of $j to be Allan M and not just Allan or M individually.

Thanks,
Allan
Patrick Wallek
Honored Contributor
Solution

Re: SQL wrapper script question

Ahh...I see.

Try this instead:

#!/bin/bash
while read j
do
(~allanm/bin/sql passwd <select member_id,member_name from ContactInfo_tbl where member_name = '${j}';
EOF
)
done < ~allanm/data
Allanm
Super Advisor

Re: SQL wrapper script question

That worked!

Thanks,
Allan