My handwittern-pl-sql command
My handwittern-pl-sql command
1.STRUCTURE
DECLARE
<declarations section>
BEGIN
<executable command(s)>
EXCEPTION
<exception handling>
END;
//--------------------------------------------------------------
DECLARE
message varchar2(20):= 'Hello, World!';
BEGIN
dbms_output.put_line(message);
END;
//--------------------------------------------------------------
3. SUMMATION
DECLARE
a integer := 10;
b integer := 20;
c integer;
f real;
BEGIN
c := a + b;
dbms_output.put_line('Value of c: ' || c);
f := 70.0/3.0;
dbms_output.put_line('Value of f: ' || f);
END;
//--------------------------------------------------------------
DECLARE
score NUMBER;
grade VARCHAR2(2);
BEGIN
-- Input the score
score := &score;
//--------------------------------------------------------------
4. LOOPS
DECLARE
i INTEGER := 1;
square INTEGER;
BEGIN
-- Loop to display numbers and their squares from 1 to 10
WHILE i <= 10 LOOP
square := i * i;
DBMS_OUTPUT.PUT_LINE('Number: ' || i || ', Square: ' || square);
i := i + 1;
END LOOP;
END;
//--------------------------------------------------------------