Create View syntax CREATE VIEW view_name AS SELECT * FROM table_name; COURSE_ID NAME DESCRIPTION DURATION PRICE 1 SQL 1 SQL course for beginners 1 week 10 2 SQL 2 SQL course for advanced 2 week 50 3 HTML5 Learn HTML 5 1 week 10 4 PHP PHP course 4 week 75 5 CSS Learn CSS…(Continue Reading)
Author: Dev
PL/SQL User defined exceptions
The user defined exceptions are user declared exceptions in the declarative part of any PL/SQL anonymous block, subprogram or package. In the first example exception was declared in the declarative part and then the exception is triggered inside the block using RAISE. The second example use RAISE_APPLICATION_ERROR inside the block with no need to declare…(Continue Reading)
PL/SQL Predefined exceptions
The predefined PL/SQL exceptions are declared globally in the package STANDARD and the system raises these exceptions implicitly. Predefined exceptions from package STANDARD have predefined names: Predefined exceptions access_into_null case_not_found collection_is_null cursor_already_open dup_val_on_index invalid_cursor invalid_number login_denied no_data_found no_data_needed not_logged_on others program_error rowtype_mismatch self_is_null storage_error subscript_beyond_count subscript_outside_limit sys_invalid_rowid timeout_on_resource too_many_rows value_error zero_divide
PL/SQL Zero_divide
The zero_divide exception is an predefined exception of PL/SQL language and catch error when pl/sql program attempts to divide a number by zero. Zero_divide example 1 declare v_sum number := 10; v_divide number := 0; v_result number; begin v_result := v_sum / v_divide; dbms_output.put_line(‘v_result: ‘||v_result); exception when zero_divide then dbms_output.put_line(‘ZERO_DIVIDE: ‘||sqlerrm); end; Output: ZERO_DIVIDE: ORA-01476:…(Continue Reading)
PL/SQL Invalid_number
The invalid_number exception is an predefined exception of PL/SQL language and catch error when pl/sql program try to insert or update non numeric values in a database number column. Invalid_number example create table x_table(x_col number); table X_TABLE created. declare begin insert into x_table (x_col) values (‘aaa’); –insert into x_table (x_col) values (10); exception when invalid_number…(Continue Reading)