PL/SQL基本语法要素(组图)(二)

2014-11-24 10:16:01 · 作者: · 浏览: 2
table.recordnumber%type index by binary_integer;
  table1 tabletype1;
  table2 tabletype2;
  begin
  table1(1):=大学;
  table1(2):=大专;
  table2(1):=88;
  table2(2):=55;
  dbms_output.put_line(table1(1)table2(1));
  dbms_output.put_line(table1(2)table2(2));
  end;
  
  【配套程序位置】:第9章 tabletypedefine1.sql。
  
 PL/SQL基本语法要素(组图)(图六)

  “”是连接字符串的运算符。
  

  5. 定义多维表类型变量
  
  在【SQLPlus Worksheet】中执行下列PL/SQL程序,该程序定义了名为tabletype1的多维表类型,相当于多维数组,table1是多维表类型变量,将数据表tempuser.testtable中recordnumber为60的记录提取出来存放在table1中并显示。执行结果如图9.12所示。
  
  Declare
  type tabletype1 is table of testtable%rowtype index by binary_integer;
  table1 tabletype1;
  begin
  select * into table1(60)
  from tempuser.testtable
  where recordnumber=60;
  dbms_output.put_line(table1(60).recordnumbertable1(60).currentdate);
  end;
  
  【配套程序位置】:第9章 tabletypedefine2.sql。

  PL/SQL基本语法要素(组图)(图七)

<script type="text/java script">BAIDU_CLB_fillSlot("771048");
点击复制链接 与好友分享! 回本站首页
<script> function copyToClipBoard(){ var clipBoardContent=document.title + '\r\n' + document.location; clipBoardContent+='\r\n'; window.clipboardData.setData("Text",clipBoardContent); alert("恭喜您!复制成功"); }
分享到: 更多
<script type="text/java script" id="bdshare_js" data="type=tools&uid=12732"> <script type="text/java script" id="bdshell_js"> <script type="text/java script"> var bds_config = {'snsKey':{'tsina':'2386826374','tqq':'5e544a8fdea646c5a5f3967871346eb8'}}; document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js cdnversion=" + Math.ceil(new Date()/3600000)