SPL problem
Posted in 1999
Topics: Stored Procedures & SPL
Can anyone point out the undoubtedly silly mistake in the following code
snippet. 'mytable' was created correctly:
=======================================================================
create table mytable(
pro_ref char( 16 ),
app_reg_no integer,
total_pts integer,
local_pts integer );
create procedure upd_prop(
p_pro_ref like property.pro_ref,
p_stat like property.stat,
p_fut_st like property.fut_st )
delete from mytable where pro_ref = p_pro_ref;# ^
# 201: A syntax error has occurred.
#
if ( p_stat = "2" and p_fut_st is NULL )
or p_fut_st = "4" then
insert into mytable ( p_pro_ref, TODAY ); end if
end procedure
========================================================================
TIA!
--
Surfer!
Just a guess:
is "like table.column" only allowed in 4gl???
HTH
Michael
"Surfer!" wrote:
> Can anyone point out the undoubtedly silly mistake in the following code
> snippet. 'mytable' was created correctly:
>
> =======================================================================
> create table mytable(
> pro_ref char( 16 ),
> app_reg_no integer,
> total_pts integer,
> local_pts integer );>
> create procedure upd_prop(
> p_pro_ref like property.pro_ref,
> p_stat like property.stat,
> p_fut_st like property.fut_st )>
> delete from mytable where pro_ref = p_pro_ref;> # ^
> # 201: A syntax error has occurred.
> #
>
> if ( p_stat = "2" and p_fut_st is NULL )
> or p_fut_st = "4" then
> insert into mytable ( p_pro_ref, TODAY );> end if
> end procedure
> ========================================================================
>
> TIA!
>
> --
> Surfer!
In article <DXfjuHAdP473Ewds@nevis-view.demon.co.uk>,
nevis-view@nospam.demon.co.uk (Surfer!) wrote:
>
> Can anyone point out the undoubtedly silly mistake in the following code
> snippet. 'mytable' was created correctly:
>
> =======================================================================
> create table mytable(
> pro_ref char( 16 ),
> app_reg_no integer,
> total_pts integer,
> local_pts integer );>
>
> create procedure upd_prop(
> p_pro_ref like property.pro_ref,
> p_stat like property.stat,
> p_fut_st like property.fut_st )>
> delete from mytable where pro_ref = p_pro_ref;> # ^
> # 201: A syntax error has occurred.
> #
[cutting]
AFAIK you can only use like as part of the define syntax and not within
the passed params syntax
PS Posting the version can be very helpful:-))
Paul Watson # I don't suffer from
WF Software Ltd. # stress, I'm just
Tel. (+44) 1436 674729 # a carrier
Fax. (+44) 1436 678693 #
www.wfsoftware.com
You define mytable, but use property in you example. Typo? If not,
is property a valid table that has the columns named in the 'like'
clause?
>
>Can anyone point out the undoubtedly silly mistake in the following code
>snippet. 'mytable' was created correctly:
>
>=======================================================================
>create table mytable(
> pro_ref char( 16 ),
> app_reg_no integer,
> total_pts integer,
> local_pts integer );>
>
>create procedure upd_prop(
> p_pro_ref like property.pro_ref,
> p_stat like property.stat,
> p_fut_st like property.fut_st )>
Surfer! (nevis-view@nospam.demon.co.uk) wrote: : Can anyone point out the undoubtedly silly mistake in the following code : snippet. 'mytable' was created correctly: : ======================================================================= : create table mytable( : pro_ref char( 16 ), : app_reg_no integer, : total_pts integer, : local_pts integer ); : create procedure upd_prop( : p_pro_ref like property.pro_ref, : p_stat like property.stat, : p_fut_st like property.fut_st ) -- You need a semi-colon, no? depending on the version there are --other attributes you could add. : delete from mytable where pro_ref = p_pro_ref; : # ^ : # 201: A syntax error has occurred. : # : if ( p_stat = "2" and p_fut_st is NULL ) : or p_fut_st = "4" then : insert into mytable ( p_pro_ref, TODAY ); : end if : end procedure : ======================================================================== : TIA! : -- : Surfer! -- Rob Wilson rwilson@ntsource.com
Umm isn't the table named "mytable" so the LIKE clauses should be
mytable.pro_ref, etc or is that a simplification typo from posting?
"Surfer!" wrote:
>
> Can anyone point out the undoubtedly silly mistake in the following code
> snippet. 'mytable' was created correctly:
>
> =======================================================================
> create table mytable(
> pro_ref char( 16 ),
> app_reg_no integer,
> total_pts integer,
> local_pts integer );>
> create procedure upd_prop(
> p_pro_ref like property.pro_ref,
> p_stat like property.stat,
> p_fut_st like property.fut_st )>
> delete from mytable where pro_ref = p_pro_ref;> # ^
> # 201: A syntax error has occurred.
> #
>
> if ( p_stat = "2" and p_fut_st is NULL )
> or p_fut_st = "4" then
> insert into mytable ( p_pro_ref, TODAY );> end if
> end procedure
> ========================================================================
>
> TIA!
>
> --
> Surfer!