Re: SQL from a C-Shell

From: Will <wkooiman_at_earthlink.net>
Date: 1 Aug 2001 01:17:30 -0700
Message-ID: <7256fcf8.0108010017.42d4427d_at_posting.google.com>


stm_at_iol.ie (Sean O'Brien) wrote in message news:<19e9e498.0107310404.7c1d575a_at_posting.google.com>...
> Hi
>
> I am having a little difficulty with a script, but can't understand
> why. This is the result of the script :
>
> # brillo [~/scripts] <143> test.csh
> #
> # 1 row created.
> #
> # SQLEND: << terminator not found
> # brillo [~/scripts] <144>
>
> I have called the same SQL query a number of different times, but only
> the first one works. Once inside the while loop it has a problem with
> the query, any idea why this is or how to fix it?
>
>
> #!/bin/csh -f
>
> set x = 0
>
> sqlplus -s scott/tiger_at_irmit << SQLEND
> INSERT INTO SEAN_USER_ALERT(name)
> VALUES ($x)
> /
> SQLEND
>
>
> while ($x < 5)
>
> set x=`echo "$x + 1" | bc`
>
> sqlplus -s scott/tiger_at_irmit << SQLEND
> INSERT INTO SEAN_USER_ALERT(name)
> VALUES ($x)
> /
> SQLEND
> end

Your slash has to be in the first column. I've always used semicolons, so that doesn't effect me. I'm not saying semicolons are better, it's just habit.

So your script should look like this:

<snip>
while ($x < 5)         

        set x=`echo "$x + 1" | bc`         

	sqlplus -s scott/tiger_at_irmit << SQLEND
	INSERT INTO SEAN_USER_ALERT(name)
	VALUES ($x)
/
	SQLEND

end

Looks weird hunh? I guess that's why I've always used the semicolon.

Will. Received on Wed Aug 01 2001 - 10:17:30 CEST

Original text of this message