oracle programming

in #oracle7 years ago

system.message_level:=15;

DECLARE
V_ID VARCHAR2(20);
BEGIN
IF :STUDENT_INFO3.ST_ID IS NULL then

SELECT 'ST'||LPAD(TO_NUMBER(NVL(MAX(SUBSTR(ST_ID,3,6)),'0'))+ 1, 6,'0')
INTO V_ID
FROM STUDENT_INFO3;

------------------------ INSERT ------------------------------------------
INSERT INTO STUDENT_INFO3(ST_ID,
ST_NAME,
REG ,
ROLL,
F_NAME,
M_NAME,
PHON_NUMBER,
EAMIL,
ADDRESS)
VALUES
(V_ID,
:STUDENT_INFO3.ST_NAME,
:STUDENT_INFO3.REG,
:STUDENT_INFO3.ROLL,
:STUDENT_INFO3.F_NAME,
:STUDENT_INFO3.M_NAME,
:STUDENT_INFO3.PHON_NUMBER,
:STUDENT_INFO3.EAMIL,
:STUDENT_INFO3.ADDRESS);

FORMS_DDL('COMMIT');

CLEAR_FORM(no_validate);

            SET_ITEM_PROPERTY('BTN_BLK.ADD_BNT',ENABLED,PROPERTY_TRUE);
            SET_ITEM_PROPERTY('BTN_BLK.CLOSE_BNT',ENABLED,PROPERTY_TRUE);
            SET_ITEM_PROPERTY('BTN_BLK.EDIT_BNT',ENABLED,PROPERTY_TRUE);
                GO_ITEM('BTN_BLK.ADD_BNT');
            SET_ITEM_PROPERTY('BTN_BLK.SAVE_BNT',ENABLED,PROPERTY_FALSE);
            SET_ITEM_PROPERTY('BTN_BLK.REVART_BNT',ENABLED,PROPERTY_FALSE);

GO_BLOCK('STUDENT_INFO31');
CLEAR_BLOCK(NO_VALIDATE);
EXECUTE_QUERY;
----------------------UPDATE---------------------------------------------------
ELSIF :STUDENT_INFO3.ST_ID IS NOT NULL then

UPDATE STUDENT_INFO3
SET
ST_NAME =:STUDENT_INFO3.ST_NAME,
REG =:STUDENT_INFO3.REG,
ROLL =:STUDENT_INFO3.ROLL,
F_NAME =:STUDENT_INFO3.F_NAME,
M_NAME =:STUDENT_INFO3.M_NAME,
PHON_NUMBER =:STUDENT_INFO3.PHON_NUMBER,
ADDRESS =:STUDENT_INFO3.ADDRESS,
EAMIL =:STUDENT_INFO3.EAMIL
WHERE ST_ID =:STUDENT_INFO3.ST_ID;

FORMS_DDL('COMMIT');

GO_BLOCK('STUDENT_INFO3');
CLEAR_BLOCK(NO_VALIDATE);   
                    
GO_BLOCK('STUDENT_INFO31');
CLEAR_BLOCK(NO_VALIDATE);

EXECUTE_QUERY;
FIRST_RECORD;

        SET_ITEM_PROPERTY('BTN_BLK.ADD_BNT',ENABLED,PROPERTY_TRUE);
        SET_ITEM_PROPERTY('BTN_BLK.EDIT_BNT',ENABLED,PROPERTY_TRUE);
        SET_ITEM_PROPERTY('BTN_BLK.CLOSE_BNT',ENABLED,PROPERTY_TRUE);
            GO_ITEM('BTN_BLK.ADD_BNT');
        SET_ITEM_PROPERTY('BTN_BLK.SAVE_BNT',ENABLED,PROPERTY_FALSE);
        SET_ITEM_PROPERTY('BTN_BLK.REVART_BNT',ENABLED,PROPERTY_FALSE);

ELSE
GO_ITEM(' STUDENT_INFO3.ST_NAME');
MESSAGE('Please!!! Enter ST_NAME ...');
MESSAGE('Please!!! Enter ST_NAME ...');
END IF;

EXCEPTION
WHEN OTHERS THEN
MESSAGE(SQLERRM(SQLCODE));
MESSAGE(SQLERRM(SQLCODE));
END ;

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.034
BTC 98914.40
ETH 3374.27
USDT 1.00
SBD 3.08