All Forums Analytics
bhaskaran 9 posts Joined 05/05
07 Nov 2006
Calling sql using UNIX

I am using a unix shell script to execute a group of sql .In one sql I am using the below statementSel cast((ABC / 12 * 1000 ) as decimal(18,2))Where ever there is a asterisk it is replaced by the name of file thus throwing an error in execution of the test scriptCan any one let me know how to solve this.

Fred 1096 posts Joined 08/04
08 Nov 2006

If you don't want the shell to do substitution you can either escape individual "problem" characters with a backslash or put the entire text in single quotes:... Sel cast((ABC / 12 \* 1000 ) as decimal(18,2)) ... or... 'Sel cast((ABC / 12 * 1000 ) as decimal(18,2))' ...

bhaskaran 9 posts Joined 05/05
08 Nov 2006

Thank You for the reply.Any way I got the answer. In UNIX * is treated as Wild card character so it will take the file name. TO avoid that errorwe can use Sel (ABC /12*100) Basically I am ignoring the space between (12*100)Earlier it was like (12 * 100)Cheers,Bhaskar

You must sign in to leave a comment.