maurixgr
3rd August 2005, 00:30
I'm creating a script using the SQL Like Clause.
When I try to use a variable in order to be evaluated inside the "like" clause, the system returns an sql error 302. Does some one to know how can I use the Like Clause with a variable value? (not a static).
I try to use the parse clause but the error continues.
Part of the script
|***************************************************
select tcxxx105.codig.d:str.wbscod.level1
from tcxxx105
where nivel.d = 1
selectdo
str.wbscod.level1=str.wbscod.level1 & ".*"
sql.id=sql.parse( "select tipcs360.* " &
"from tipcs360,tcxxx105 " &
"where tcxxx105.compo.d = tipcs360.cpcp " &
"and tcxxx105.codig.d like :1" )
sql.where.bind(sql.id,1,str.wbscod.level1)
sql.exec(sql.id)
while ( true )
on case ( sql.fetch(sql.id) )
case eendfile:
break
case 0:
num.array.bau(num.counter)=lval(tcxxx105.codig.d)
num.counter=num.counter+1
num.array.bau(num.counter)=-1
continue
default: | error
message("Error %d occurred", db.error())
endcase
break
endwhile
sql.break(sql.id)
sql.close(sql.id)
sql.id = 0
endselect
|***************************************************
Thanks
Maurix
When I try to use a variable in order to be evaluated inside the "like" clause, the system returns an sql error 302. Does some one to know how can I use the Like Clause with a variable value? (not a static).
I try to use the parse clause but the error continues.
Part of the script
|***************************************************
select tcxxx105.codig.d:str.wbscod.level1
from tcxxx105
where nivel.d = 1
selectdo
str.wbscod.level1=str.wbscod.level1 & ".*"
sql.id=sql.parse( "select tipcs360.* " &
"from tipcs360,tcxxx105 " &
"where tcxxx105.compo.d = tipcs360.cpcp " &
"and tcxxx105.codig.d like :1" )
sql.where.bind(sql.id,1,str.wbscod.level1)
sql.exec(sql.id)
while ( true )
on case ( sql.fetch(sql.id) )
case eendfile:
break
case 0:
num.array.bau(num.counter)=lval(tcxxx105.codig.d)
num.counter=num.counter+1
num.array.bau(num.counter)=-1
continue
default: | error
message("Error %d occurred", db.error())
endcase
break
endwhile
sql.break(sql.id)
sql.close(sql.id)
sql.id = 0
endselect
|***************************************************
Thanks
Maurix