10. In PL/SQL, how do you assign variables the same type as a column in the data
ID: 3710247 • Letter: 1
Question
10. In PL/SQL, how do you assign variables the same type as a column in the database? 11. How do you place the results of a SELECT command into variables in PL/SQL? 12. Can you use INSERT, UPDATE, or DELETE commands that affect more than one row in PLISQL procedures? 13. How do you use a SELECT command that retrieves more than one row in a PL/SOL procedure? 14. Which PL/SQL command activates a cursor? 15. Which PL/SQL command selects the next row in a cursor? 16. Which PL/SQL command deactivates a cursor? 17. How do you use SQL commands in Access? 19. How do you move to the next record in a recordset in Access? 20. What are triggers? What purpose do they serve?Explanation / Answer
10 ans)create or replace procedure example (
myvariable IN mytable.id%TYPE)
this creates a variable myvariable of type id in mytable
11 ans)
myvariable number;
select max(sales) into myvariable from extable where id=1;
this statement gets the result and stored in myvariable
12 ans)we can use insert,update and delete comands that can affect more than one row in pl/sql procedures
13 ans)DECLARE
myvariable mytable.id%TYPE;
CURSOR mycursore IS
SELECT id FROM mytable WHERE id = 120;
BEGIN
OPEN mycursore;
FETCH mycursore INTO myvariable
DBMS_OUTPUT.PUT_LINE(myvariable);
CLOSE mycursore;
END;
we should use cursors for multiple records to select and display
14 ans)
open ,fetch,close
open to allocate memory
fetch to iterate rows
close to close the cursors
15 ans)LEAD is used for new row in pl/sql cursors
16 ans)
close cursorname;
this command is used for closing the cursor which was used
17 ans)
select [e-mail] phone from mytable where id=102;
example for select in access
20 ans)
triggers are used
when suppose a database operation is done in one table.
and we also need to done operation in another table .if done for first table
then to have operation in another table we use triggers
we have before and after triggers
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.