在oracle数据库中,定义变量的类型,可以为:变量名 数据表.列名%type 或是变量名 数据表%rowtype 例如: declare mytable testtable%rowtye 或是 mytable testtable .currendate%rowtye begin select * into mytable from tempuser.testtable where recordnumber=80; dbms_output.put_line(mytable.currentdate); end
------------- 这两种方式定义变量,其实目定就是让变量类型的定义更灵活一些,当数据表中字段的类型变了,不用改程序!mytable testtable%rowtye 比mytable testtable .currendate%rowtye 更加灵活一些,可以指向数据表中的任何一个字段,而后者只可以指向特定的字段!