Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
15Activity
0 of .
Results for:
No results containing your search query
P. 1
Oracle Samples

Oracle Samples

Ratings: (0)|Views: 1,040|Likes:
Published by api-3747607
contains oracle good samples
contains oracle good samples

More info:

Published by: api-3747607 on Oct 15, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

pl/pdf examples
http://www.plpdf.com/23-926.html
http://plnet.org/
http://orafaq.com/cgi-bin/sqlformat/pp/utilities/sqlformatter.tpl //gr8 site

_____________
begin
execute immediate 'garbage';
exception

when others then
dbms_output.put_line( 'error msg is'||sqlcode);
dbms_output.put_line( 'error code is '||sqlerrm );

dbms_output.put_line( 'new code is '||dbms_utility.format_error_backtrace );
dbms_output.put_line (
'type of statement executed: '
|| dbms_sql.last_sql_function_code ( )
);

raise;
end;
/

--------
how can one search pl/sql code for a string/ key value?
select type, name, line
from
user_source
where upper(text) like '%&keyword%';

__________
how can one search pl/sql code for a string/ key value?
select object_name,

to_char(created,

'dd-mon-rr hh24:mi') create_time,
to_char(last_ddl_time, 'dd-mon-rr hh24:mi') mod_time,
status

from
user_objects
where last_ddl_time > '&check_from_date';

___________
set serveroutput on size 200000
-------
is there a limit on the size of a pl/sql block?
yes, the max size is not an explicit byte limit, but related to the parse tree
that is created when you compile the code. you can run the following select
statement to query the size of an existing package or procedure:
select * from dba_object_size where name = 'procedure_name';

----------
sql and pl/sql formatter site
http://orafaq.com/cgi-bin/sqlformat/pp/utilities/sqlformatter.tpl

----------
rem-----------------------------------------------------------------------
rem filename:

encode.sql
rem purpose:
demonstrate simple encoding and decoding of secret messages
rem
this method can be extended to create simple password
rem
encryption
rem date:
15-feb-2001
rem author:
frank naude, oracle faq
rem-----------------------------------------------------------------------
select translate(
'hello world',
-- message to encode
'abcdefghijklmnopqrstuvwxyz ',

'1234567890!@#$%^&*()-=_+;,.') encoded_message
from dual
/select translate(

'85@@%._%*@4',

-- message to decode
'1234567890!@#$%^&*()-=_+;,.',
'abcdefghijklmnopqrstuvwxyz ') decoded_message

from dual
/--------------------

rem-----------------------------------------------------------------------
rem filename: password.sql
rem purpose:

simple password encryption package to demonstrate how
rem
values can be encrypted and decrypted using oracle's
rem
dbms obfuscation toolkit
rem note:
connect to sys as sysdba and run ?/rdbms/admin/catobtk.sql
rem date:
18-mar-2003
rem author:
frank naude, oracle faq
rem-----------------------------------------------------------------------

create or replace package password as
function encrypt(i_password varchar2) return varchar2;
function decrypt(i_password varchar2) return varchar2;

end password;
/show errors
create or replace package body password as
-- key must be exactly 8 bytes long
c_encrypt_key varchar2(8) := 'key45678';

function encrypt (i_password varchar2) return varchar2 is
v_encrypted_val varchar2(38);
v_data

varchar2(38);

begin
-- input data must have a length divisible by eight
v_data := rpad(i_password,(trunc(length(i_password)/8)+1)*8,chr(0));

dbms_obfuscation_toolkit.desencrypt(
input_string
=> v_data,
key_string
=> c_encrypt_key,
encrypted_string => v_encrypted_val);
return v_encrypted_val;
end encrypt;
function decrypt (i_password varchar2) return varchar2 is
v_decrypted_val varchar2(38);
begin
dbms_obfuscation_toolkit.desdecrypt(
input_string
=> i_password,
key_string
=> c_encrypt_key,
decrypted_string => v_decrypted_val);
return v_decrypted_val;
end decrypt;
end password;
/show errors

-- test if it is working...
select password.encrypt('password1') from dual;
select password.decrypt(app_password.encrypt('password1')) from dual;
select password.encrypt('psw2') from dual;
select password.decrypt(app_password.encrypt('psw2')) from dual;

------------------
/*
------------------------------------------------------------------------------
filename: random.txt
purpose:
random number/ string generator package
author:
unknown
original: http://orafaq.net/scripts/sql/random.txt
edits:
19990908 phil rand <prand@spu.edu> added functions rand_string(), smaller().
------------------------------------------------------------------------------
*/
create or replace package random

is
procedure srand(new_seed in number);
procedure get_rand(r out number);
procedure get_rand_max(r out number, n in number);
function rand return number;
function rand_max(n in number) return number;
function rand_string(ssiz in number) return varchar2;
function smaller(x in number, y in number) return number;
pragma restrict_references(rand, wnds);
pragma restrict_references(rand_max, wnds);
pragma restrict_references(random, wnds, rnps);
pragma restrict_references(rand_string, wnds);
pragma restrict_references(smaller, wnds);

end random;
/create or replace package body random
is
multiplier
constant number := 22695477;
increment
constant number := 1;
"2^32"
constant number := 2 ** 32;
"2^16"
constant number := 2 ** 16;
"0x7fff"
constant number := 32767;
seed
number
:= 1;
function smaller(x in number, y in number) return number is
begin
if x <= y then
return x;
else return y;
end if;

Activity (15)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Chouchène Nader liked this
ReaderTim5 liked this
userPL liked this
brijesh1747 liked this
Zafar Habib liked this
AlvaroGomes liked this
joe_inba liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->