Step 1:- Create Table
CREATE
TABLE
"TEST"
(
ID
VARCHAR(50),
C_DATE VARCHAR(10)
DEFAULT(TO_CHAR(SYSDATE,
'dd-MM-yyyy'))
);
Step 2:- Create function
CREATE
OR
REPLACE
FUNCTION
TEST_FN_GET_DATEWISE_SR_No
RETURN
NUMBER
AS
V_SR_No NUMBER;
BEGIN
SELECT
NVL(MAX(ID),0)
INTO
V_SR_No
FROM
"TEST"
WHERE
C_DATE = TO_CHAR(SYSDATE, 'dd-MM-yyyy');
RETURN
(V_SR_No+1);
END
TEST_FN_GET_DATEWISE_SR_No;
Step 3:- Insert record in
Test table
INSERT
INTO
"TEST"(ID) VALUES(TEST_FN_GET_DATEWISE_SR_No());
Step 4:- Select record from
Test Table
SELECT * FROM "TEST"