Tuesday, June 27, 2017

Program1- Write a program to print the Hello Message to the terminal

Solution-often we start writing the first program as hello Message.

So let us write the first hello program using various methods.

Method-1:Using Anonymous block Code- SQL> begin 2 dbms_output.put_line('HELLO'); 3 end; 4 / HELLO PL/SQL procedure successfully completed. SQL> Method-2:Using PROCEDURE code- SQL> SET SERVEROUTPUT ON SQL> CREATE OR REPLACE PROCEDURE hello 2 AS 3 BEGIN 4 dbms_output.put_line('Hello World!'); 5 END; 6 / Procedure created. SQL> Note- we can execute the procedure in two way - Use SET SERVEROUTPUT ON command to view the output on terminal- 1. SQL> EXECUTE hello; Hello World! PL/SQL procedure successfully completed. SQL> 2. SQL> BEGIN 2 hello; 3 END; 4 / Hello World! PL/SQL procedure successfully completed. SQL>

Tuesday, June 20, 2017

Oracle-Concatenation Operator(||)

Concatenation Operator(||)

Concatenation operator is used to concatenate the column or string to another column or string and it is represented by two vertical bar (||).

SQL Statement-

select 'The employee Name '||Ename||' and employee id is '||empno As   "Employee Information" from emp

Result-
             Employee Information
The employee Name KING and employee id is 7839
The employee Name BLAKE and employee id is 7698
The employee Name CLARK and employee id is 7782
The employee Name JONES and employee id is 7566
The employee Name SCOTT and employee id is 7788
The employee Name FORD and employee id is 7902
The employee Name SMITH and employee id is 7369