随笔分类 - sql pl/sql
摘要:网上找到很多写法,有些对有些不对,自己摸索,找到一些可以通过测试的写法,总结如下(均以hr schema举例)。1. 普通的select返回 1 declare 2 v_name employees.last_name%type; 3 v_salary number; 4 p_id employees.employee_id%type; 5 begin 6 p_id := 102; 7 execute immediate 'select last_name,salary from employees where employee_id=:...
阅读全文
posted @ 2013-04-07 11:46
valleylord
摘要:查了很多地方,下面这个写法是对的,以oracle hr用户为例。参考:http://www.veryhuo.com/a/view/16095.htmldeclare c char(8); lc_sql char(4000); lc_job_rec jobs%rowtype; type cur_type is ref cursor; cur_jobs cur_type;begin c := 'pu'; dbms_output.put_line(c); lc_sql := 'select j.* from jobs j where lower(j.job_title) li
阅读全文
posted @ 2013-02-07 13:48
valleylord
摘要:转载自:http://www.cnblogs.com/oldcat/archive/2011/08/17/2142995.html1With子句1.1学习目标掌握with子句用法,并且了解with子句能够提高查询效率的原因。1.2With子句要点with子句的返回结果存到用户的临时表空间中,只做一次...
阅读全文
posted @ 2012-11-07 14:53
valleylord
摘要:赋予远程debug权限:grant debug any procedure to #user_name; grant debug connect session to #user_name; 导入导出整个schema,需要先建立dpdir的directory:expdp schemaABC/sche...
阅读全文
posted @ 2012-11-07 14:40
valleylord
摘要:参考Kyte的《Oracle专家高级编程》第11章。环境:Oracle 11g2(memory_target=1808M),PL/SQL Developer 9.0。测试内容是在一个只有1列的空表中插入100000行,比较速度,单用户模式,分有无主键两种情况。create table t_num (...
阅读全文
posted @ 2012-11-07 14:36
valleylord
摘要:动态SQL游标的例子,来自:http://www.itpub.net/thread-257998-1-1.htmlstrSQL:='SELECT * FROM ' || tmp_tbl;open c_sign_stat for strSQL;函数返回游标的例子,来自:http://soft.zdne...
阅读全文
posted @ 2012-11-07 14:30
valleylord

浙公网安备 33010602011771号