Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews DB Oracle Interviews:Concepts and ArchitectureData AccessDatabase ArchitectureDatabase ManagementDatabase Security OracleDistributed ProcessingFlexfieldForms ReportsGeneral OracleMemory ManagementMTO-SAP Financial AccountingOCIOracle AOLOracle AROracle Backup RecoveryOracle D2KOracle DatabaseOracle Database DeveloperOracle DB OptimizationOracle DBAOracle DeveloperOracle ETLOracle Forms 3.0Oracle Forms 4.0Oracle GLOracle PL-SQLOracle RMANOracle ScenariosOracle SecurityOracle SQLOracle System ArchitectureOracle Technology Network (OTN)Programmatic ConstructsRAC (Real Application Clusters)SQL Plus
Copyright © 2018. All Rights Reserved
Oracle Database Interview Question:
How To Use "OUT" Parameter Properly?
Submitted by: AdministratorHere are the rules about OUT parameters:
► A formal OUT parameter acts like an un-initialized variable. It must be assigned with new values before the end of the procedure or function.
► An actual OUT parameter must be a variable.
► An actual OUT parameter will not pass any value to the formal parameter.
► An actual OUT parameter will receive a copy of the value from the formal parameter at the end of the procedure or function.
Here is good example of a procedure with an OUT parameter:
SQL> CREATE OR REPLACE PROCEDURE WELCOME AS
2 SITE CHAR(40) := 'globalguideline.com';
3 MESSAGE CHAR(80);
4 PROCEDURE WELCOME_PRINT(S IN CHAR, M OUT CHAR) AS
5 BEGIN
6 M := 'Welcome to ' || S;
7 END;
8 BEGIN
9 WELCOME_PRINT('MySpace.com', MESSAGE);
10 DBMS_OUTPUT.PUT_LINE(MESSAGE);
11 WELCOME_PRINT(SITE, MESSAGE);
12 DBMS_OUTPUT.PUT_LINE(MESSAGE);
13 END;
14 /
SQL> EXECUTE WELCOME;
Welcome to MySpace.com
Welcome to globalguideline.com
Submitted by: Administrator
► A formal OUT parameter acts like an un-initialized variable. It must be assigned with new values before the end of the procedure or function.
► An actual OUT parameter must be a variable.
► An actual OUT parameter will not pass any value to the formal parameter.
► An actual OUT parameter will receive a copy of the value from the formal parameter at the end of the procedure or function.
Here is good example of a procedure with an OUT parameter:
SQL> CREATE OR REPLACE PROCEDURE WELCOME AS
2 SITE CHAR(40) := 'globalguideline.com';
3 MESSAGE CHAR(80);
4 PROCEDURE WELCOME_PRINT(S IN CHAR, M OUT CHAR) AS
5 BEGIN
6 M := 'Welcome to ' || S;
7 END;
8 BEGIN
9 WELCOME_PRINT('MySpace.com', MESSAGE);
10 DBMS_OUTPUT.PUT_LINE(MESSAGE);
11 WELCOME_PRINT(SITE, MESSAGE);
12 DBMS_OUTPUT.PUT_LINE(MESSAGE);
13 END;
14 /
SQL> EXECUTE WELCOME;
Welcome to MySpace.com
Welcome to globalguideline.com
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.