PL/SQL基础总结

总结第一次全面写pl/sql基础 

 

1、“=” 是比较,“:=”是赋值,

2.sys_refcursor 返回结果集类型之一,动态sql打开(可以查看对应文章),

 EXECUTE IMMEDIATE get_count_sql INTO n_countA,n_countP; 动态sql执行 count类型SQL :select count(*) from table;

3.动态sql字符串拼接单引号问题:2个单引号 :trunc(sysdate,'||'''YYYY'''||') 等译trunc(sysdate,'yyyy');

4.    --自定义接受类型;

    type my_record is record(  

      n_lossno gcpolicypaidhistorytemp.lossno%type,

      n_lossseqno gcpolicypaidhistorytemp.lossseqno%type,

      n_upload gcpolicypaidhistorytemp.upload%type); 

    my_rec my_record;

5.异常信息打印

    exception when others then

       v_backtrace := dbms_utility.format_error_backtrace;

        dbms_output.put_line(v_backtrace);

http://www.yiibai.com/plsql/plsql_cursors.html 这个基础教程很好 

猜你喜欢

转载自lanrikey.iteye.com/blog/2346679