Calling sql using UNIX

Analytics
Enthusiast

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 statement

Sel 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 script

Can any one let me know how to solve this.
2 REPLIES
Teradata Employee

Re: Calling sql using UNIX

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))' ...
Enthusiast

Re: Calling sql using UNIX

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 error

we can use Sel (ABC /12*100)

Basically I am ignoring the space between (12*100)
Earlier it was like (12 * 100)

Cheers,
Bhaskar