Build an anonymous block that will trigger an error. : Select into « PL SQL Statements « Oracle PL/SQL Tutorial






SQL> CREATE TABLE dummy ( dummy_value VARCHAR2(1));

Table created.

SQL>
SQL>
SQL> DECLARE
  2    my_string         VARCHAR2(1) := ' ';
  3    my_number         NUMBER;
  4
  5  BEGIN
  6
  7    SELECT ' ' INTO my_string FROM dummy;
  8
  9    my_number := TO_NUMBER(my_string);
 10
 11  EXCEPTION
 12
 13    WHEN no_data_found THEN
 14      dbms_output.put_line('SELECT-INTO'||CHR(10)||SQLERRM);
 15
 16  END;
 17  /
SELECT-INTO
ORA-01403: no data found

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> drop table dummy;

Table dropped.

SQL>
SQL>








22.10.Select into
22.10.1.Use Select into statement to assign value to a variable
22.10.2.Multiple-Row SELECT Command with Several Exception-Handling Routines: set value in exception handler
22.10.3.Select data into record type data
22.10.4.Select data into PL/SQL table of cursor
22.10.5.Select count value into a variable
22.10.6.Use if statement to check the selected into value
22.10.7.Use more than one entrances in if statement to handle the value returned from a select into
22.10.8.Retrieving a single row: The basic syntax
22.10.9.Use IF-THEN-ELSE to check the return value from the select into statement
22.10.10.SELECT into ROWTYPE
22.10.11.SELECT into TYPE
22.10.12.Multiple-row SELECT command.
22.10.13.Multiple-row SELECT command with several exception-handling routines
22.10.14.Create a loop that prints a list of all employees and their managers
22.10.15.You must have the same datatypes in both the SELECT and INTO clauses.
22.10.16.select pair value into two variables
22.10.17.Build an anonymous block that will trigger an error.
22.10.18.Demo a SELECT INTO with exception handling
22.10.19.Select into and subquery