Subject | Re: [IBO] Getting value back from SP |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-01-31T11:02:24Z |
At 08:54 AM 31-01-02 -0800, Dion wrote:
If you don't need to have the value on the client at all, then remove the BENID column altogether from your insert stored procedure's input list and use a trigger for it.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com
>Hi,You can get it on the client by calling the Gen_ID() function of the statement (TIB_DSQL, etc.) or of the connection - then you can pass it as a parameter from the client. With the dataset types, you can use GeneratorLinks.
>
>Using the following SP(an extract)
>
>ALTER PROCEDURE INSERT_BEN
>(
> MEMBEN_BENID INTEGER,
> BEN_ID VARCHAR(15),
> BEN_INITIALS VARCHAR(5),
> BEN_FIRSTNAME VARCHAR(30),
> BEN_SURNAME VARCHAR(30),
> BEN_TITLEID SMALLINT,
> BEN_HOMETEL VARCHAR(15),
> MEMBEN_MEMBERID VARCHAR(15),
> MEMBEN_RELATIVETYPEID INTEGER,
> MEMBEN_OPTIONID INTEGER,
> MEMBEN_FUNDID INTEGER,
>)
>RETURNS
>(
> BENID INTEGER
>)
>AS
>BEGIN
> BENID = :MEMBEN_BENID
> IF (BENID IS NULL) THEN
> BENID = GEN_ID( BENID_GEN, 1 );
> INSERT INTO BENEFICIARY ( BENID
> , ID
> , INITIALS
> , SURNAME
> , FIRSTNAME
> , TITLEID
> , HOMETEL
>
> VALUES ( :BENID
> , :BEN_ID
> , :BEN_INITIALS
> , :BEN_FIRSTNAME
> , :BEN_SURNAME
> , :BEN_TITLEID
> , :BEN_HOMETEL
>
> INSERT INTO MEMBERBEN ( MEMBERID
> , BENID
> , RELATIVETYPEID
> , OPTIONID
> , FUNDID
>
> VALUES ( :MEMBEN_MEMBERID
> , :BENID
> , :MEMBEN_RELATIVETYPEID
> , :MEMBEN_OPTIONID
> , :MEMBEN_FUNDID
>END
>
>in the InsertSQL section of a TIB_QUERY, I get the error that the BENID has
>not been assigned a value.
>Is this because Delphi does not know about the value generated on the
>Server? If so, How do I assign it on the Client.
If you don't need to have the value on the client at all, then remove the BENID column altogether from your insert stored procedure's input list and use a trigger for it.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com