Firebird Generators and Oracle Sequences

We will post tips and tricks not posted in our documentation to help fill the gap.

Firebird Generators and Oracle Sequences

Postby mike.griffin on Mon Jul 25, 2005 6:09 pm

It wasn't possible to auto-detect them but we do support them. This example is showing how to use a Firebird Generator on the EMP_NO column on the EMPLOYEE table. The first step is to enter a special indicator in the User Meta Data which is available via the \"L\" icon on the menu. You need to navigate to the table in question and click on it in the Meta Browser Tree window, then enter a name/value pair in the user meta data window. See the image below:

Image

User Meta data syntax for using a Generator in a SQL INSERT statement is as follows, both methods below will return the generator value after save. Be sure to regenerate both your stored procedures and business entities as both templates check these special values when generating.

KEY=GEN:I:EMP_NO VALUE=\"EMP_NO_GEN\" -- Uses \"I$EMP_NO = GEN_ID(EMP_NO_GEN, 1);\" in the stored proc
KEY=GEN:I:T:EMP_NO VALUE=\"EMP_NO_GEN\" -- Assumes a trigger does the incrementing

You can have more than one per update or insert. You simply need to add these to your local user meta data as key/value pairs on the parent table not the column itself. Also, if you want to use generators in UPDATE statements you can add these values too GEN:U: or GEN:U:T

For Oracle use:

SEQ:I:
SEQ:U:
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron