Subject Re: [firebird-support] creating next record
Author Helen Borrie
At 07:58 AM 10/05/2006, you wrote:
> I have a single picture in a blob. I can read and write the
>picture blob.
>
> I created the table with this command.
>
>CREATE TABLE PATIENT (PATIENT_IMAGE BLOB SUB_TYPE 0 SEGMENT SIZE
>80,PATIENT_ID INTEGER NOT NULL)")
>
>
> I filled the record the blob with the command
>
>insert into PATIENT (PATIENT_ID,PATIENT_IMAGE) values ('1001',?)",
>(pictureIn,))
>
>
> I am now looking for the command that will allow me to create a
>new PATIENT_ID with the number of 1002. (one number larger than the
>last PATIENT_ID #.)
> is there a way to retrive the last record created value?

Don't even think of doing that. Use a generator.

>I also know that there is a special command that will assign a number
>to a record and will never allow that record number to be reused.

See

http://www.firebirdsql.org/manual/generatorguide.html
http://www.firebirdsql.org/pdfmanual/Firebird-Generator-Guide.pdf

./heLen