Social Icons

Showing posts with label DBMS. Show all posts
Showing posts with label DBMS. Show all posts

Friday, 20 December 2013

IF else program in pl-sql

set serveroutput on;
DECLARE
   total_rows number(2);
BEGIN
   UPDATE e1111
   SET esalary = esalary + 500;
   IF sql%notfound THEN
      dbms_output.put_line('no customers selected');
   ELSIF sql%found THEN
      total_rows := sql%rowcount;
      dbms_output.put_line( total_rows || ' customers selected ');
   END IF;
END;

Function s in PL/SQL

set serveroutput on;
set verify off;
declare
a int;
c int;
b int;

function pied(x in  number)
return number
is
v number(2);
begin
c:=x+10;
return(c);

end pied;


begin
a:=&a;
 b:=pied(a);
dbms_output.put_line(b);
end;

Tuesday, 3 December 2013

Function s in PL/SQL

set serveroutput on;
set verify off;
declare
a int;
c int;
b int;

function pied(x in  number)
return number
is
v number(2);
begin
c:=x+10;
return(c);

end pied;


begin
a:=&a;
 b:=pied(a);
dbms_output.put_line(b);
end;

Function s in PL/SQL

set serveroutput on;
set verify off;
declare
a int;
c int;
b int;

function pied(x in  number)
return number
is
v number(2);
begin
c:=x+10;
return(c);

end pied;


begin
a:=&a;
 b:=pied(a);
dbms_output.put_line(b);
end;

Sum of two no. using procedure in pl/sql

set serveroutput on;
declare
a int;
c int;
b int;

procedure pie(x IN number, y in number ,Z in out number)
is
begin
z:=x+y;
end;



begin
pie(5,6,a);
dbms_output.put_line('hello '||a);
end;

LOCAL PROCEDURE in PL/SQL

set serveroutput on;
declare
a int;
c int;
b int;

procedure pie(x in out number)
is
begin
x:=x+10;


end;

begin
a:=5;
pie(a);

dbms_output.put_line('hello '||a);
end;

IMPLICIT Cursor in PL/SQL

set serveroutput on;
declare
idc number(2);

begin

update e1111 set id=id+500;


if sql%notfound then
dbms_output.put_line('not found');

ELSIF sql%found THEN
      idc := sql%rowcount;
      dbms_output.put_line( idc || ' customers selected ');
   END IF;
END;

PL/SQL While Loop

set serveroutput on;
set verify off;
declare
i int:=1;
j int;
begin
WHILE i<10 loop
dbms_output.put_line(i);
i:=i+1;

end loop;

end;

output :













Printing pattern in PL/SQL

set serveroutput on;
set verify off;
declare
i int;
j int;
begin
for i in 1..5 loop
 dbms_output.put_line('');
 for j in 1..i loop
   dbms_output.put('*');
 end loop;
  dbms_output.new_line;
end loop;

end;

OUTPUT :


** 
*** 
**** 
*****

PL/SQL Simple Loop

set serveroutput on;
set verify off;
declare
b int:=1;
begin

loop
dbms_output.put_line(''||b);
b:=b+1;
exit when b>=10;
end loop;
end;

PL/SQL if-else Statements

set serveroutput on;
set verify off;
declare
a int;
begin
a:=&a;
if a>50 then
dbms_output.put_line('you are old');
elsif a>30 and a<50 then

dbms_output.put_line('you are young');

else

dbms_output.put_line('you are child');

end if;

end;

Sunday, 20 October 2013

dbms pl/sql curser

set serveroutput on;
DECLARE
   total_rows number(2);
BEGIN
   UPDATE e1111
   SET esalary = esalary + 500;
   IF sql%notfound THEN
      dbms_output.put_line('no customers selected');
   ELSIF sql%found THEN
      total_rows := sql%rowcount;
      dbms_output.put_line( total_rows || ' customers selected ');
   END IF;
END;

Wednesday, 25 September 2013

getrlimit and setrlimit function

#include <sys/resource.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main (int argc, char *argv[])
{
  struct rlimit limit;
  
  /* Set the file size resource limit. */
  limit.rlim_cur = 65535;
  limit.rlim_max = 65535;
  if (setrlimit(RLIMIT_FSIZE, &limit) != 0) {
    printf("setrlimit() failed with errno=%d\n", errno);
    exit(1);
  }

  /* Get the file size resource limit. */
  if (getrlimit(RLIMIT_FSIZE, &limit) != 0) {
    printf("getrlimit() failed with errno=%d\n", errno);
    exit(1);
  }

  printf("The soft limit is %llu\n", limit.rlim_cur);
  printf("The hard limit is %llu\n", limit.rlim_max);
  exit(0);
}
 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management