oracle record

-------- begining of the structure of test --------
/*
userId    userName
1    John1
2    John2
3    John3
4    John4
5    John5
*/

 

------------- record 1 ---------------
declare
    v_record test%ROWTYPE;

begin
    select * into v_record from test where userid = 4;
    dbms_output.put_line(v_record.userid ||','|| v_record.username);
end;


------------- record 2 ---------------
declare
    type v_record is record(userid test.userid%type, username varchar2(20));
    real_record v_record;

begin
    select userid, username into real_record from test where userid = 4;
    dbms_output.put_line(real_record.userid ||','|| real_record.username);
end;

posted on 2008-08-28 11:58  Good life  阅读(1188)  评论(1编辑  收藏  举报