Create a PL/SQL block to update the location ID for an existing department, which has location ID preceded with 'HQ' as 'HQ-BLR-101'.
Answers
Answered by
2
Answer:
Explanation:
MY question is why did you add
1) LIKE
2) 'HQ%'
Answered by
0
Answer:
DECLARE
v_loc department.location_id%type;
BEGIN
SELECT 'HQ-BLR-101' into v_loc FROM department WHERE ocation_id LIKE 'HQ%';
INSERT into department(department_id, department_name, location_id)
SELECT department_id, department_name, v_loc FROM department WHERE location_id LIKE 'HQ%';
COMMIT;
END;
Explanation:
- PL/SQL is a block-structured language that lets programmers combine SQL's functionality with procedural commands. All of a block's statements are sent to the Oracle engine at the same time, which speeds up processing and reduces bandwidth.
- PL/SQL is a procedural language that includes decision-making, iteration, and other procedural programming characteristics.
- PL/SQL allows you to run several queries in a single block with a single command.
- Procedures, functions, packages, triggers, and types are PL/SQL units that may be saved in the database and reused by applications.
- The exception handling block in PL/SQL is a feature that allows you to handle exceptions that occur in PL/SQL blocks.
- PL/SQL applications are portable to any computer hardware or operating system that supports Oracle.
- PL/SQL has a lot of error checking.
#SPJ3
Similar questions