Here’s a simple question about how to create a sequence with variables.
I wanna create a sequence using a combination of system time as it’s start value. How should I do that.
Here’s what I wrote:
DECLARE
SQS number :=(sysdate - to_date('01-JAN-1970','DD-MON-YYYY')) * (864000);
sql_stmt varchar2(200);
BEGIN
sql_stmt := 'create SEQUENCE XXXX_id_seq MINVALUE 100000 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH :1 CACHE 500 NOORDER CYCLE';
EXECUTE IMMEDIATE sql_stmt using SQS;
END;
but it says invalid num.
I know it’s a noobie question. but I really need help here.
You can’t bind variables in DDL statements (I ain’t got doc or a good reason why, but quite a few references mentioning the fact), you’ve got to concatenate all in one.