DBMS_OUTPUT.PUT_LINE('Message or Variable');
CREATE OR REPLACE PROCEDURE GET_CUSTOMER AS BEGIN DBMS_OUTPUT.PUT_LINE('Hello World! ThaiCreate.Com'); END;
EXEC GET_CUSTOMER();
CREATE OR REPLACE PROCEDURE GET_CUSTOMER AS BEGIN DECLARE strName VARCHAR(50) := 'Weerachai Nukitram'; intAge NUMBER := 25; BEGIN DBMS_OUTPUT.PUT_LINE('Name = ' || strName); intAge := intAge + 5; DBMS_OUTPUT.PUT_LINE('Age = ' || intAge); END; END;
CREATE OR REPLACE PROCEDURE GET_CUSTOMER AS BEGIN DECLARE iCountCustomer NUMBER := 0; BEGIN SELECT COUNT(*) INTO iCountCustomer FROM CUSTOMER; DBMS_OUTPUT.PUT_LINE('Customer Count = ' || iCountCustomer); END; END;
CREATE OR REPLACE PROCEDURE GET_CUSTOMER AS BEGIN DECLARE sCustomerID CUSTOMER.CUSTOMER_ID%TYPE := 'C001'; sName CUSTOMER.NAME%TYPE; sEmail CUSTOMER.EMAIL%TYPE; sCountyCode CUSTOMER.COUNTRY_CODE%TYPE; iBudget CUSTOMER.BUDGET%TYPE; iUsed CUSTOMER.USED%TYPE; BEGIN SELECT NAME, EMAIL, COUNTRY_CODE, BUDGET, USED INTO sName, sEmail, sCountyCode, iBudget, iUsed FROM CUSTOMER WHERE CUSTOMER_ID = sCustomerID; DBMS_OUTPUT.PUT_LINE('Customer ID = ' || sCustomerID); DBMS_OUTPUT.PUT_LINE('Name = ' || sName); DBMS_OUTPUT.PUT_LINE('Email = ' || sEmail); DBMS_OUTPUT.PUT_LINE('Country Code = ' || sCountyCode); DBMS_OUTPUT.PUT_LINE('Budget = ' || iBudget); DBMS_OUTPUT.PUT_LINE('Used = ' || iUsed); END; END;
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท