• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Some PL/SQL

Albatross

Platinum Member
DECLARE
x NUMBER(2);
BEGIN
x:=22;
FOR v IN 1..5 LOOP
IF v NOT IN (8,9) THEN
INSERT INTO lucru VALUES(v);
END IF;
END LOOP;
END;
/

Could somebody enlighten me how this sequence writes 2 in the table?
It`s from a multiple choice test it only says that the name of the table is lucru.
 
Based on what you've posted and assuming there's no table constraints or underlying triggers, this inserts a record for 1-5 in the 'lucru' table. So '2' is one of the records written.

it seems somewhat incorrect or missing a few parts as the variable x is not referenced at all within the loop.
 
Based on what you've posted and assuming there's no table constraints or underlying triggers, this inserts a record for 1-5 in the 'lucru' table. So '2' is one of the records written.

it seems somewhat incorrect or missing a few parts as the variable x is not referenced at all within the loop.

Yeah,probably something is missing.Thanks.
 
Back
Top