摘要: --查询存储过程 --select * from user_source order by name; clear; select * from user_source where name = 'ADD_USER_INFORMATION'; --查询函数: --var sname = upper('get_sal'); --select * from user_source where name = 'GET_SAL'; select * from user_source where upper(name)= upper('get_sal'); --查询包: select * from user_source where upper(name)=upper('pack_test') and upper(type) = upper('package'); --删除存储过程: drop procedure add_user_information; -- --删除函数: drop function get_val; --删除包: drop pa 阅读全文
posted @ 2010-06-04 20:32 叮当小马 阅读(487) 评论(0) 推荐(0)
摘要: clear; --创建函数: create or replace function get_sal(name in varchar2) return number as v_sal emp.sal%type; begin select sal into v_sal from emp where upper(ename)= upper(name); return v_sal; Exception when no_data_found then raise_application_error(-20000,'该雇员不存在.'); end; / var sal number; exec :sal := get_sal('scott'); --print sal; sal --------- 3000 阅读全文
posted @ 2010-06-04 20:31 叮当小马 阅读(340) 评论(0) 推荐(0)
摘要: http://topic.csdn.net/t/20041126/22/3592748.html --参考资料: --包 CREATE OR REPLACE PACKAGE PAG_CUR_TEST --创建一个包 AS TYPE c_TYPE IS REF CURSOR; PROCEDURE prc_selecttestip(p_CUR In OUT c_TYPE); --存储过程带参数 END PAG_CUR_TEST; / --存储过程 CREATE OR REPLACE PACKAGE BODY PAG_CUR_TEST --创建一个包,创建包体 AS PROCEDURE prc_selecttestip(p_CUR In OUT c_TYPE) AS BEGIN OPEN p_CUR FOR SELECT * FROM ip_test; END 阅读全文
posted @ 2010-06-04 19:17 叮当小马 阅读(701) 评论(0) 推荐(0)
摘要: 参考资料:http://reallyafei.javaeye.com/blog/391097 创建基本表 -- Create table create table USER_INFORMATION ( P_ID NUMBER, USER_LOGIN_NAME NVARCHAR2(30) ) 创建包: create or replace package pack_test is type cur_test is ref cursor; end pack_test; / --这个不能少呀,加上这个就可以在sql/plus中运行了,这个是结束符号 创建存储过程 create or replace procedure proc_cur(p_id in number,p_cur out pack_test.cur_test) is v_sql varchar2(400); begin if p_id = 0 then op 阅读全文
posted @ 2010-06-04 18:30 叮当小马 阅读(1191) 评论(0) 推荐(0)