CREATE TABLE : TEST
Name Null? Type----------------------------------------------------- -------- ------------------------------------
ID NUMBER(10)
NAME VARCHAR2(50)
OPRTR VARCHAR2(10)
INDATE DATE
LUSR VARCHAR2(10)
LUDT DATE
create table test
(
ID NUMBER(10),
NAME VARCHAR2(50),
OPRTR VARCHAR2(10),
INDATE DATE,
LUSR VARCHAR2(10),
LUDT DATE
);
- CREATE A BLANK PAGE.
- ADD TWO ITEMS : ID AND NAME
- ADD TWO BUTTONS : update and insert (SAVE) AND CLEAR
- GO TO PROCESS:
- CREATE PROCESS:
declare
VMESS VARCHAR2(1000);
p_upduser varchar2(10);
begin
p_upduser := :app_user;
IF :P8_ID IS NULL THEN
VMESS:=VMESS||'ID,';
END IF;
IF :P8_NAME IS NULL THEN
VMESS:=VMESS||'NAME,';
END IF;
IF LENGTH(LTRIM(RTRIM(VMESS)))>2 THEN
apex_error.add_error(
p_message => VMESS
, p_display_location => apex_error.c_inline_in_notification);
ELSE
UPDATE TEST SET
NAME =:P8_NAME,
lusr= p_upduser,
ludt=sysdate
WHERE ID=:P8_ID;
IF SQL%NOTFOUND THEN
INSERT INTO TEST (ID,NAME,OPRTR,INDATE)
VALUES (:P8_ID,:P8_NAME,p_upduser,sysdate);
END IF;
COMMIT;
apex_application.g_print_success_message := '<span>Saved</span>';
END IF;
END;
>>>>> WHEN-BUTTON-PRESSED :
ADD THE BUTTON : SAVE.
2. CREATE PROCESS: CLEAR:
This will clear the session state.
TYPE : Clear Session State.
3. Dynamic Action : To Show Previous Data.
Dynamic Action :
Execute PL/SQL code:
SELECT NAME INTO :P8_NAME
FROM TEST
WHERE ID=:P8_ID;
Event : Change
Selection Type : Item(s)
Items: P8_ID
True:
Execute PL/SQL code :
SELECT NAME INTO :P8_NAME FROM TEST WHERE ID=:P8_ID;
Items to Submit : P8_ID
Items to Return : P8_NAME
Tags:
Oracle Apex