Use Macro to generate Primary key while Inserting records
Hi, I want to insert some records in the database and want to use Macro to generate the primary key of the table while inserting records. I want to know if this possible in teradata.
I have a sequence table say:
SEQUENCES : SEQ_NM VARCHAR(10), SEQ_VAL INTEGER
I have another table say STUDENT: STUDENT_ID INTEGER, STUDENT_NM VARCHAR(50)
I also have a macro that returns the next available sequence number. To insert the data currently I first call the macro and then use the value returned by the macro in my insert statement.
Now, I want to write a single insert statement that will use the macro to generate the ID and also insert the record in the database in one call like we can do in Oracle using Oracle sequences.nextVal.