Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Certifications Interviews:AFMCAIIMS ExamCCDA CertificationCCIE CertificationCCIP CertificationCCSP CertificationCertificationsCheck Point CertificationCISCO CertificationCIW CertificationEngineering Entrance ExamsEntrance ExamsGATE ExamIBM CertificationICET ExamIIT JEEISTQB CertificationManagement Entrance ExamsMATMCDBA CertificationMCSD.NET - 70-089MCSD.NET - 70-300MCSD.NET - 70-306 ExamMCSD.NET - 70-310 ExamMCSD.NET - 70-315 ExamMCSD.NET - 70-316 ExamMCSD.NET - 70-320 ExamMCSD.NET - 70-330 ExamMCSD.NET - 70-340 ExamMCTS .Net CertificationMedical Science Entrance ExamsMicrosoft CertificationMSCE 2003 CertificationNovell CertificationNovell CLE 9 CertificationNovell CLP CertificationNovell CNA CertificationNovell CNE CertificationNovell MCNE CertificationOCP 9i DBA CertificationOPENMAT ExamOracle Application DeveloperOracle CertificationPMI CertificationPost Graduation Entrance ExamsRed Hat CertificationS/W Quality AssuranceSun CertificationSybase CertificationTesting Certification
Copyright © 2018. All Rights Reserved
Oracle Application Developer Interview Question:
Explain Can we give DML statements inside a function?
Submitted by: AdministratorYES YOU CAN USE DML(SELECT) WITHIN User defined function(UDF). BUT KEEP IN MIND THAT UDF CAN ONLY RETURN ONE SINGLE VALUE. BUT YOU CANT USE DDL(CREATE/ALTER/DROP) WITHIN UDF. TO DO THAT YOU HAVE TO USE SP(Stored Procedure).
DML EXAMPLE:
CREATE OR REPLACE Function IncomeLevel
( name_in IN varchar2 )
RETURN varchar2
IS
monthly_value number(6);
ILevel varchar2(20);
cursor c1 is
select monthly_income
from employees
where name = name_in;
BEGIN
open c1;
fetch c1 into monthly_value;
close c1;
IF monthly_value <= 4000 THEN
ILevel := 'Low Income';
ELSIF monthly_value > 4000 and monthly_value <= 7000 THEN
ILevel := 'Avg Income';
ELSIF monthly_value > 7000 and monthly_value <= 15000 THEN
ILevel := 'Moderate Income';
ELSE
ILevel := 'High Income';
END IF;
RETURN ILevel;
END;
Submitted by: Administrator
DML EXAMPLE:
CREATE OR REPLACE Function IncomeLevel
( name_in IN varchar2 )
RETURN varchar2
IS
monthly_value number(6);
ILevel varchar2(20);
cursor c1 is
select monthly_income
from employees
where name = name_in;
BEGIN
open c1;
fetch c1 into monthly_value;
close c1;
IF monthly_value <= 4000 THEN
ILevel := 'Low Income';
ELSIF monthly_value > 4000 and monthly_value <= 7000 THEN
ILevel := 'Avg Income';
ELSIF monthly_value > 7000 and monthly_value <= 15000 THEN
ILevel := 'Moderate Income';
ELSE
ILevel := 'High Income';
END IF;
RETURN ILevel;
END;
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.