CREATE OR REPLACE PACKAGE BODY temp_package_demo is FUNCTION f_demo(userid NUMBER) RETURN BOOLEAN IS v_temp ); BEGIN INTO v_temp FROM scott.emp WHERE empno = userid; RETURN TRUE; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE; END; PROCEDURE p_demo_1…
CREATE OR REPLACE PACKAGE temp_package_demo is v_demo ); PROCEDURE p_demo_1(userid NUMBER DEFAULT v_demo, SAL number); FUNCTION f_demo(userid NUMBER) RETURN BOOLEAN; END temp_package_demo;…
declare v_empno scott.emp.empno%type; v_sal scott.emp.sal%type; cursor cur_emp is select t.empno, t.sal from scott.emp t; begin open cur_emp; loop fetch cur_emp into v_empno, v_sal; exit when cur_emp%notfound; dbms_output.put_line(v_empno || ' ' || v…
declare v_empno scott.emp.empno%type; v_sal scott.emp.sal%type; ) is select t.empno, t.sal from scott.emp t where t.empno = v_empno; begin ); loop fetch cur_emp into v_empno, v_sal; exit when cur_emp%notfound; dbms_output.put_line(v_empno || ' ' || v…
declare v_sal ) :; begin --if you could not see the output in console, you should set output on first use the command in command line : set serveroutput on dbms_output.put_line(v_sal); end;…
/* 一.函数? 1.函数定义 函数的内容 根据实际需要来定义 2.使用的方式 */ -- 定义函数 根据部门编号查询出部门的总人数 create or replace function fn( deno dept.deptno%type )return number as v_count number; begin select count(*) into v_count from emp where deptno=deno; return v_count; dbms_output.put_l…
DECLARE v_sql ) := ''; v_count NUMBER; BEGIN v_sql := v_sql || 'select count(1) from scott.emp t'; EXECUTE IMMEDIATE v_sql INTO v_count; dbms_output.put_line(v_count); END;…
CREATE OR REPLACE FUNCTION function_name RETURN DATE AS v_date DATE; BEGIN ; dbms_output.put_line(v_date); RETURN v_date; END function_name;…
declare v_sal ) :; begin --if you could not see the output in console, you should set output on first use the command in command line : set serveroutput on dbms_output.put_line(v_sal); end;…
-- refer: -- http://www.cnblogs.com/gnielee/archive/2009/09/09/1563154.html -- http://www.cnblogs.com/yudy/archive/2012/07/18/2597874.html ); CREATE OR REPLACE FUNCTION splitstr(p_string IN VARCHAR2, p_delimiter IN VARCHAR2 := ',') RETURN ty_str_spli…