Showing posts with the label PL/SQL

SQL PLSQL Top Reserved Keywords

To become perfect in PL/SQL is an art. Knowing of top reserved words helps you to be a master in SQL. ... Top List of SQL, PLSQL Reserved Words. You Can Refer Before Writing Queries Before you start knowing reserved words, wait one moment. The reserved words are similar to the words that you use in normal SQL. A Video on Basic PL/SQL Related Posts 32 Complex SQL Queries popular e-book Introduction to SQL and PLSQL by Ruchin Jain

PL SQL: How to Fix Errors

PL/SQL is procedural language, and the PL/SQL procedures you can call from any high-level language. This is depending on your project requirement. PL SQL  How to prevent some common errors or exceptions while writing PL/SQL procedures in your project. The number one and primary one is assigning variables non-numeric to numeric. This is one kind of area where you need to look in while writing PL/SQL procedure. PL/SQL is nothing but an invitation for trouble. They are all centered on data types and implicit conversion. What's implicit conversion? Let's say you have number held in a varchar2 data type variable, v_value. You try assigning n_value, a number data type variable, that value with the following line of code:n_value := v_value; That should work, right? Yes, it should, but when it doesn't, because you don't actually have a numeric literal stored in variable v_value, the implicit data type conversion will raise an "unexpected" exception in

PL/SQL Sample code and error handling mechanism

SAMPLE PL/SQL CREATE TABLE dummy ( dummy_value VARCHAR2(1)); DECLARE -- Define local variable. my_string VARCHAR2(1) := ' '; my_number NUMBER; BEGIN -- Select a white space into a local variable. SELECT ' ' INTO my_string FROM dummy; -- Attempt to assign a single white space to a number. my_number := TO_NUMBER(my_string); EXCEPTION WHEN no_data_found THEN dbms_output.put_line('SELECT-INTO'||CHR(10)||SQLERRM); END; / Output and Error: The program returns the following output, which illustrates formatting user- defined exceptions.  The CHR(10) inserts a line return and provides a clean break between the program's SQLCODE and SQLERRM messages: RAISE my_error SQLCODE [1]  SQLERRM [User-Defined Exception]