Output:
value of a is 10
value of a is 8
First condition 10>6 is true so value 10 is printed
then, the value of a is decreased by 2 and a=8, the condition is true so 8 is printed
and value is decreased by 2 and a=6 now 6>6 condition is false and the loop is terminated.
16- What is the output of the following PL/SQL block? DECLARE a INTEGER10; BEGIN WHILE a6...
DECLARE x number := 10; BEGIN LOOP dbms_output.put_line(x); x := x + 10; IF x > 50 THEN exit; END IF; END LOOP; -- after exit, control resumes here dbms_output.put_line('After Exit x is: ' || x); END; / NOTE: Can you provide the output screenshot of the following code
PL/SQL gap-fill question:
For the following stored procedure, please fill in the missing
information in the underlined areas:
create or replace procedure get_items_shipped_capt as
cursor list_items(cid in captain.capt_id%type) is
select item.item_no,_____________________ ,weight from
item,shipment_line,shipment
where item.item_no = ____________________________ and
shipment_line.shipment_id = shipment.shipment_id and
shipment.capt_id = ___________;
cursor all_captains is
select capt_id
from captain;
TB constant char(1) := CHR(9);
begin
for cp in _____________ loop
dbms_output.put_line(Captain ID: '||cp.capt_id);
dbms_output.new_line;
dbms_output.put_line('Item
Number'||TB||'Description'||TB||'Weight');
dbms_output.put_line('=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
=+=+');
for det in list_items(______________) loop
dbms_output.put_line(det.item_no||TB||det.description||TB||
det.weight);
end...
1. Create an PL/SQL anonymous block. Using a “while” loop, display on the console those rows where a quantity of shipments for a project are greater than the average quantity of shipments for that project. 2. Repeat using a FOR loop. // TABLE INFO : SHIPMENTS(SUPPLIERNO, PARTNO, PROJECTNO, QUANTITY, SHIPDATE, ARRIVEDATE)
Oracle PL/SQL Using Dynamic SQL to create a procedure named add_row_sp for inserting a row into a table with three columns: add_rows (p_table_name VARCHAR2, p_column1 NUMBER, p_column2 VARCHAR2, p_column3 NUMBER). Testing the procedure by using the following block to add a record to the BB_TAX table: BEGIN add_row_sp ('BB_TAX', 4, 'SD', 0.02); END;
PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....
Please help with the following code. I keep getting error ORA-06533: Subscript beyond count. I am trying to get the first 10 records in the emp table listed in reverse. I also get error ORA-6512. Please help. DECLARE CURSOR e_emp is SELECT ename, sal FROM emp; type namesarray IS VARRAY(10) OF emp.ename%type; type salarray IS VARRAY(10) OF emp.sal%type; names namesarray := namesarray(); salary salarray := salarray(); counter integer := 10; BEGIN FOR n IN REVERSE e_emp LOOP counter := counter...
What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set TheNumber = 12 For (Count = 10; Count>TheNumber; Count--) Write TheNumber + Count End For A) The limit condition in a For loop cannot be a variable B) The loop will never be entered since the initial value of Count is less than the test condition C) The loop will never end since the test condition will never be met D) A counter must...
Oracle 11g PL/SQL Programming Sometimes Brewbean’s customers mistakenly leave an item out of a basket that’s already been checked out, so they create a new basket containing the missing items. However, they request that the baskets be combined so that they aren’t charged extra shipping. An application page has been developed that enables employees to change the basket ID of items in the BB_BASKETITEM table to another existing basket’s ID to combine the baskets. A block has been constructed to...
2. What is the output of the following code fragment? n = 1; while (n <= 5) { n++; cout << n << ' '; a.1 2 3 4 5 b. 1 2 3 4 c. 1 1 1 forever d. 2 3 4 5 e. 2 3 4 5 6 3. What is the termination condition for the following While loop? while (beta > 0 && beta < 10) { cout << beta << endl; cin >> beta; }...
(PL/SQL Programming) Consider the table EMPLOYEE with attributes ID, Name, and Hours, and the table PAYINFO with attributes Regular, Overtime, and HourLimit, defined and populated by the following script: DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE EMPLOYEE ( ID CHAR(5), Name VARCHAR2(16), Hours NUMBER(2), CONSTRAINT PK_EMPLOYEE PRIMARY KEY (ID) ); INSERT INTO EMPLOYEE VALUES ('22144', 'Anderson', 30); INSERT INTO EMPLOYEE VALUES ('31902', 'Bruford', 45); INSERT INTO EMPLOYEE VALUES ('42771', 'Wakeman', 20); INSERT INTO EMPLOYEE VALUES...