Oracle PL\SQL 基础学习三

一. PL/SQL 与 SQL的交互

1. 使用select语句.into是必须的, 查询只能返回一条或0条数据

    declare
       v_fname employees.first_name%TYPE;  --更正规的写法
       --v_fname varchar2(25);
    begin
       select first_name into v_fname
       from employees where employee_id=200;
       DBMS_OUTPUT.PUT_LINE('First Name is: ' || v_fname);
    end;

2.Insert

 

 

3. Update

 

二. PLSQL tansaction

conn hr/123456

create table tt(id int);

conn /as sysdba

desc v$transaction 动态事务表

select xid,xidusn from v$transaction;  如果事务没有提交,则该表中会存在记录,提交后记录消失。

 

三 游标

1. 隐式游标

posted on 2014-05-23 11:08  shawn.wang  阅读(141)  评论(0编辑  收藏  举报

导航