[ PL/SQL ] - Simple PL/SQL statement.

Results 1 to 1 of 1
  1. #1
    C# - Java - Notepad Ben is offline
    ModeratorRank
    Jul 2013 Join Date
    BelguimLocation
    1,228Posts

    [ PL/SQL ] - Simple PL/SQL statement.


    RaGEZONE Recommends

    RaGEZONE Recommends

    Hello everyone, today we will be looking at PL/SQL the basic syntax into the SQL programming language.

    PL-SQL is a block-structure language.. this means that the actual program that you write is splitted into diffirent parts.

    Every PL/SQL block is split into 3 parts:

    • Declarations
    • Executable Commands
    • Exception Handling


    The declaration section will start with the keyword DECLARE this section is not required as you don't always need variables in your PL/SQL program.

    The Executable section is enclosed between The BEGIN and the END. this section is required as this is the core of your SQL program.

    A simple example of a PL/SQL program:
    Spoiler:

    DECLARE
    message varchar2(20) := 'Hello RaGEZONE';
    BEGIN
    dbms_output.put_line(message);
    END;


    :=

    As you see in the exampe, we decalre a variabele called message as a varchar with a length of 20.
    the := means that your gonna give the variabele a value, 'Hello RaGEZONE' in our example.

    Dbms_output.put_line();

    dbms_output.put_line(); will print a line, as of our example, the dbms_output.put_line() has a variabele passed within the () which holds our text.

    The dbms will show 'Hello RaGEZONE' in our sql terminal.

    You can compare the dbms_output.put_line() with a System.out.println() or a Console.writeLine(); in java or C#.

    Cheers!





Advertisement