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...
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....
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...
using sql answer the following i need to double check my answers Question 1 Controls the flow of execution based on a condition begin...end try...catch goto if...else 10 points Question 2 Changes the database context to the specified database. set alter exec use 10 points Question 3 Exits the innermost WHILE loop. goto quit return break 10 points Question 4 Controls the flow of execution when an error occurs declare on error goto try...catch continue...error 10 points Question 5 Declares...
Given the following algorithm:
Algorithnm Input: a1, a2,...,an, a sequence of numbers n, the length of the sequence x, a number Output: ?? i:- 1 While (x2 # a, and i < n) i+1 End-while If (x- - a) Return(i) Return(-1) 3, -1, 2,9, 36,-7, 6,4 a) What is the correct output of the Algorithm with the following input: a1, a2,..an b) What is the asymptotic worst-case time complexity of the Algorithm?
Algorithnm Input: a1, a2,...,an, a sequence of numbers...