This is about a simple booking/reservation table: key is anId for a timeOfBooking and dateOfBooking.
But when I try to do: insert if-not-exist, update if-exist, about a identifier linked to a time with this code:
declare anId varchar[18];
declare aDate;
declare aTimeStamp;
set @anId =?;
set @aDate=?;
set @aTimeStamp=?;
if (exists (select * from Booking as t where t.AnId = @anId ))
begin update Booking set Date = @aDate and Time = @aTimeStamp where AnId= @anId end
else begin insert into Booking (AnId, Date, Time) values(@anId , @aDate, @aTimeStamp) end ;
I end up with the jdbc layer returning this error :
'varchar' is not a recognized CURSOR option.
Any idea what's wrong?
You should put @ for variable names
declare @anId varchar(18);
declare @aDate datetime;
declare @aTimeStamp datetime;