Skip to main content

Posts

Showing posts with the label PL/SQL

Some of Top Sql Aptitude Questions for

Top Sql Aptitude Questions for Aptitude Some SQL Aptitude questions for Aptitude Preparations Q  Which  is  the  subset  of  SQL  commands  used  to  manipulate  Oracle  Database structures, including tables? Data Definition Language (DDL) Q  What operator performs pattern matching? LIKE operator Q  What operator tests column for the absence of data? IS NULL operator Q  Which command executes the contents of a specified file?    START <filename> or @<filename> Q  What is the parameter substitution symbol used with INSERT INTO command?    &amp; Q  Which command displays the SQL command in the SQL buffer, and then executes it?.    RUN Q.  What are the wildcards used for pattern matching?    _ for single character substitution and % for multi-character substitution Q  State true or false. EXISTS, SOME, ANY are operators in SQL.   ...

PL/SQL to Create or Replace Triggers, Varray and nested tables

Question: 1) Create orreplace trigger trig_msg after update ordelete or insert on customer for each row Code: declare oper varchar2(10); begin if updating then DBMS_OUTPUT.PUT_LINE('UPDATING'); end if; if deleting then DBMS_OUTPUT.PUT_LINE('DELETING'); end if; if inserting then DBMS_OUTPUT.PUT_LINE('INSERTING'); end if; end; SQL> set serveroutput on; SQL> insert into customer values(1,'vish','delhi',500,'21-jan-2001'); INSERTING 1 row created. SQL> delete from customer where loanno = 1; DELETING 1 row deleted. Question 2) create or replace trigger trig_nodml after update orinsert or delete on loan for each row Code: declare m varchar2(15); begin if updating then RAISE_APPLICATION_ERROR(-20000,'NO UPDATE ALLOWED'); end if; if deleting then RAISE_APPLICATION_ERROR(-20000,'NO DELETING ALLOWED'); end if; if inserting then m:=TO_CHAR(sysdate,'DAY'); if (upper(m)<...