Subject Re: [firebird-support] Re: Select + Update in a single SPROC?
Author Lucas Franzen
hartertobak schrieb:
> Hhmm, okay. Thank you for helping, but this still doesn´t work:

yes, your syntax is really harter tobak ;-)


SET TERM #;

ALTER PROCEDURE SP_TBLONE_INS_UPD(
SEARCHTERM VARCHAR(400) CHARACTER SET UTF8 DEFAULT NULL)
RETURNS(
SEARCHEXISTS SMALLINT)
AS
DECLARE VARIABLE getid INTEGER;
BEGIN
GETID = NULL;

SELECT ID
FROM TBLONE
WHERE SEARCHTERM = :SEARCHTERM
INTO :GETID;

IF ( GETID IS NULL ) THEN
BEGIN
/* make your procedures READABVALE! */
INSERT INTO TBLONE
( SEARCHTERM, LASTSEARCH, SEARCHCOUNT)
VALUES
(:SEARCHTERM,cast('now' as timestamp), 1 );
END

SUSPEND; /* what is this good for? */

END #
SET TERM ;#


Luc.