You would get this error when you use "Sequence in Plsql block with assignment ",
But actually, assigning sequence to particular variable can be only from 11g version on wards.
So check database version before using Sequence with assignment operator.
SELECT * FROM V$VERSION;--- To know DB version
10g: Using select Statement for Sequence
DECLARE
V_FILE_NAME VARCHAR2(200);
BEGIN
SELECT TO_CHAR(SYSDATE, 'DDMMYYYY') || '_' ||
LPAD(SEQ_CBOP_FILE.NEXTVAL, 4, 0) || '.TXT'
INTO V_FILE_NAME
FROM DUAL;
END;
11g: Using assignment operator for sequence. and its new feature in 11g for sequence.
DECLARE
V_FILE_NAME VARCHAR2(200);
BEGIN
V_FILE_NAME := TO_CHAR(SYSDATE, 'DDMMYYYY') || '_' ||
LPAD(SEQ_CBOP_FILE.NEXTVAL, 4, 0) || '.TXT';
END;
But actually, assigning sequence to particular variable can be only from 11g version on wards.
So check database version before using Sequence with assignment operator.
SELECT * FROM V$VERSION;--- To know DB version
10g: Using select Statement for Sequence
DECLARE
V_FILE_NAME VARCHAR2(200);
BEGIN
SELECT TO_CHAR(SYSDATE, 'DDMMYYYY') || '_' ||
LPAD(SEQ_CBOP_FILE.NEXTVAL, 4, 0) || '.TXT'
INTO V_FILE_NAME
FROM DUAL;
END;
11g: Using assignment operator for sequence. and its new feature in 11g for sequence.
DECLARE
V_FILE_NAME VARCHAR2(200);
BEGIN
V_FILE_NAME := TO_CHAR(SYSDATE, 'DDMMYYYY') || '_' ||
LPAD(SEQ_CBOP_FILE.NEXTVAL, 4, 0) || '.TXT';
END;
No comments:
Post a Comment