Skip to main content

PL/SQL :

1.Hellow world program

Begin

Dbms_output.put_line(‘Hellow world!!!!!!’);

End;

/

Output:

Hellow world!!!!!

*note :-this may not show you direct output so typeà
set serveroutput on;


2.Display 2 variables

Declare

X number;

Y number;

Begin

X:=10;

Y:=20;

Dbms_output.put_line(x);

Dbms_output.put_line(y);

End;

/

Output:

10

20

OR

Declare

X number;

Y number;

Begin

X:=10;

Y:=20;

Dbms_output.put_line(‘x=’);

Dbms_output.put_line(x);

Dbms_output.put_line(‘y=’);

Dbms_output.put_line(y);

End;

/

Output:

X=

10

Y=

20



3. Addition of two number

Declare

X int;

Y int;

Z int;

Begin

X:=10;

Y:=20;

Z:=X+Y

Dbms_output.put_line(z);

End;

/

Output:

30

4.Arithm 

declare

  x int;

    y int;

    z int;

    begin

    x:=100;

    y:=200;

    dbms_output.put_line('addition');

    dbms_output.put_line(x+y);

   dbms_output.put_line('subtraction');

  dbms_output.put_line(x-y);

  dbms_output.put_line('multiplication');

  dbms_output.put_line(x*y);

  dbms_output.put_line('division');

  dbms_output.put_line(x/y);

  end;

  /



Ouput:

addition

300

subtraction

-100

multiplication

20000

division

.5


PL/SQL procedure successfully completed.



PL/SQL

Prerequicisio:

Conn

System

Root

Se serveroutput on;

1.Hellow world program



--single line commet using double hyphen

Begin

Dbms_output.put_line(‘Hellow world!!!!!!’);

End;

/

Output:

Hellow world!!!!!

*note :-this may not show you direct output so typeà set serveroutput on;

2.Display 2 variables

Declare

X number;

Y number;

Begin

X:=10;

Y:=20;

Dbms_output.put_line(x);

Dbms_output.put_line(y);

End;

/

Output:

10

20

OR

Declare

X number;

Y number;

Begin

X:=10;

Y:=20;

Dbms_output.put_line(‘x=’);

Dbms_output.put_line(x);

Dbms_output.put_line(‘y=’);

Dbms_output.put_line(y);

End;

/

Output:

X=

10

Y=

20



3. Addition of two number

Declare

X int;

Y int;

Z int;

Begin

X:=10;

Y:=20;

Z:=X+Y

Dbms_output.put_line(z);

End;

/

Output:

30

4.Arithmetic operation

 declare

  x int;

    y int;

    z int;

    begin

    x:=100;

    y:=200;

    dbms_output.put_line('addition');

    dbms_output.put_line(x+y);

   dbms_output.put_line('subtraction');

  dbms_output.put_line(x-y);

  dbms_output.put_line('multiplication');

  dbms_output.put_line(x*y);

  dbms_output.put_line('division');

  dbms_output.put_line(x/y);

  end;

  /



Ouput:

addition

300

subtraction

-100

multiplication

20000

division

.5



PL/SQL procedure successfully completed.
 

5. Program for initializing variables in declaration section

Declare

A int:=10;

Begin

Dbms_output.put_line(‘value of a is=’||A);

End;

/

Output:

 

6.Table based recors:

declare

  2  cust customers%rowtype;

  3  begin

  4  select * into cust

  5  from customers where cust_id=1;

  6  dbms_output.put_line('cust id='||cust.cust_id);

  7  dbms_output.put_line('cust name='||cust.cust_nm);

  8  dbms_output.put_line('cust address='||cust.cust_add);

  9  dbms_output.put_line('cust slary='||cust.salary);

 10  end;

 11  /

Output:

cust id=1

cust name=vishakha umale

cust address=akola

cust slary=50000






7.Cursor based record:

SQL> declare

  2  cursor cur1 is

  3  select cust_id,cust_nm,cust_add

  4  from customers;

  5  cust cur1%rowtype;

  6  begin

  7  open cur1;  --cursor is opened here

  8  loop

  9  fetch cur1 into cust;

 10  exit when cur1%notfound;

 11  dbms_output.put_line(cust.cust_id||' '||cust.cust_nm||' '||cust.cust_add);

 12  end loop;

 13  end;

 14  /











Comments

Popular posts from this blog

Naming Convention

  Naming Convention : A naming convention is  a convention for naming things: Please find below the table for naming conventions: Naming Convention Format Example Camel Case camelCase 🐪aBcD Kebab Case kebab-case 🍢a-b-c-d Snake Case snake_case 🐍a_b_c_d Pascal Case PascalCase 🧑‍🦳AbCd Flat Case flatcase 📏abcd Upper Flat Case UPPERFLATCASE ABCD Screaming Snake Case SCREAMING_SNAKE_CASE 🐍A_B_C_D Camel Snake Case camel_Snake_Case 🐪🐍ab_Cd Pascal Snake Case Pascal_Snake_Case Ab_Cd Train Case Train-Case 🚃Ab-Cd Cobol Case COBOL-CASE 🍢AB-CD

Simple java code

  Simple java code class Main{ /*Every application in Java must contain the main method. The Java compiler starts executing the code from the main method*/      public static void main(String anyVar[]){      System.out.println("Simple java code");       } } Output: Simple java code Screenshot: Online compiler:https://www.onlinegdb.com/online_java_compiler #happyCoding💁👍
IOT Internet of things. In this we can operate things automatically . ---> Like fans, lights, TV, Doors, taps, all things which we need to go and put on or off. IMP point:   IOT allows things to work as per logic . Main Problem (The overflow of bins in society or cities has following impacts) Bacteria, insects and vermin thrive from garbage Overflowing waste causes air pollution and respiratory diseases. Garbage contaminates surface waters, which affects all ecosystems.  Direct handling of overflowing waste exposes for health risks.  Inefficient waste control is bad for municipal wellbeing. Their is no one to say that bin is fully occupied or please through this garbage and empty her. So IOT provides us a new concept which take care of overflow of garbage in cities. As we know without garbage city will be neat and clean. An because of this peoples,animals will be safe from any diseases. How to prevent waste bins from overflowing? Althou...