?? oracle pl-sql學習筆記.htm
字號:
<TD bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width=618 bgColor=white>
<TABLE cellSpacing=6 cellPadding=0 width="100%"
bgColor=#ffffff border=0>
<TBODY>
<TR></TR></TBODY></TABLE><!--文章顯示代碼開始-->
<TABLE class=center_tdbgall
style="WORD-BREAK: break-all" cellSpacing=0
cellPadding=0 width=618 align=center border=0>
<TBODY>
<TR>
<TD colSpan=2></TD></TR>
<TR>
<TD class=main_Article_Title
style="WORD-BREAK: break-all" align=middle colSpan=2
height=90>Oracle PL/SQL學習筆記</TD></TR>
<TR>
<TD class=main_Article_other_Title
style="WORD-BREAK: break-all" align=middle colSpan=2
height=22>
<TABLE style="WORD-BREAK: break-all" cellSpacing=0
cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle><A
title=收藏的網頁將被永久地保存到新浪ViVi收藏夾http://vivi.sina.com.cn
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=http://smxf.gnway.net&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();">收藏此文到<FONT
color=darkorchid>VI<FONT
color=#57c200>V</FONT>I</FONT></A>| <A
title=功能強大的網絡收藏夾,一秒鐘操作收藏本文
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();">收藏此文到<FONT
color=darkorchid>365K<FONT
color=#57c200>E</FONT>Y</FONT></A>| <A
title=功能強大的網絡收藏夾,一秒鐘操作收藏本文
href="javascript:u=location.href;t=document.title;void(open('http://www.YouNote.com/NoteIt.aspx?u='+escape(u)+'&t='+escape(t)+'&c='+escape(document.selection.createRange().text),'網絡書簽', 'toolbar=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));">收藏此文到<FONT
color=darkorchid>YOU<FONT
color=#57c200>NO</FONT>TE</FONT></A>
</TD></TR></TBODY></TABLE></TD></TR>
<TR></TR>
<TR align=middle>
<TD bgColor=#f3f3f3
colSpan=5>作者:未知 數據庫來源:網絡收集 點擊數:
<SCRIPT language=javascript
src="Oracle PL-SQL學習筆記_files/GetHits.htm"></SCRIPT>
更新時間:2006-2-7</TD></TR>
<TR>
<TD class=main_tdbg_760 id=fontzoom
style="WORD-BREAK: break-all" vAlign=top colSpan=2
height=300>
<TABLE height=1 cellSpacing=0 cellPadding=0
width=618 border=0>
<TBODY>
<TR>
<TD>
<TABLE borderColor=#cccccc cellSpacing=0
cellPadding=0 width=486 align=center
bgColor=#ffffff border=0 heihgt="60px">
<TBODY>
<TR>
<TD>
<SCRIPT language=javascript
src="Oracle PL-SQL學習筆記_files/4.js"></SCRIPT>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=8 cellPadding=3 border=0>
<TBODY>
<TR>
<TD><!--插入廣告JS代碼-->
<TABLE class=zhi14
style="WIDTH: 620px; HEIGHT: 38px" height=38
cellSpacing=0 cellPadding=0 width=620
align=center border=0>
<TBODY>
<TR>
<TD width=648 height=20>
<P>1 SQL*Plus環境
<BR>--------------------------------------
<BR>show all 顯示所有SQL*Plus的命令名字 <BR>list or l
顯示緩沖區的內容 <BR>list 4 顯示當前SQL命令的第4行,并把第4行作為當前行。
<BR>change or c
用新的內容替換原來在一行中第一次出現內容,例如:SQL>c/(...)/('analyst')/
<BR>input or i 增加一行或多行 <BR>append or a 在一行后追加內容
<BR>del 刪除當前行 刪除SQL緩沖區中的當前行 <BR>run
顯示并運行SQL緩沖區中的命令 <BR>/ 運行SQL緩沖區中的命令 <BR>edit
把SQL緩沖區中的命令寫到操作系統下的文本文件, <BR>并調用操作系統提供的編輯器執行修改。
<BR>set linesize 80 設置行的大小為80個字符寬度 <BR>set
pagesize 100 設置頁的大小為100行 <BR>ttitle 'smaple
ttitle' 設置頁頭標 <BR>btitle 'smaple btitle' 設置頁腳標
<BR>spool /home/zxin10/myresult.log
設置sqlplus的輸出到文件中 <BR>spool off(out) 停止輸出文件
<BR>column column_name format a18 wrap heading
’smaple-column-title’
<BR>格式化列輸出,每列寬度18個字符,超過18個自動換行,列標題換成'column-title'
<BR>CLEAR COLUMNS 將所有列的顯示屬性設為缺省值. </P>
<P><BR>2 異常exception
<BR>--------------------------------------
<BR>no_data_found <BR>表示select沒有查詢到滿足條件的數據行。
<BR>others
<BR>表示Oracle預定義錯誤范圍之外的任何錯誤,Oracle用這個"others"捕捉所有
未知的錯誤。可以使用sqlcode函數,sqlerrm函數在錯誤處理模塊中顯示錯誤
代碼和錯誤信息。而且,others處理必須是一個塊的最后一個錯誤處理,否則,
others處理的優先級比較高,權利比較大,它會捕捉所有錯誤,包括預定義的Oracle
錯誤和非預定義的Oracle錯誤。 <BR>too_many_rows
<BR>Oracle的隱式游標,一次只能檢索一行數據,使用隱式游標時,異常處理機制如果檢測
到游標返回的數據是多行數據,它就拋出too_many_rows類型的異常。
<BR>dup_val_on_index <BR>在某個索引上,出現重復值。
<BR>value_error
<BR>在某個目標字段中,放入的數據長度或者數據范圍,超出目標字段定義的長度或者范圍
,如,把'8613905180088'這個字符串插入userid字段中,而userid定義為varchar2(10),
就會出現這種異常。 </P>
<P>Exception Raised when ...
<BR>ACCESS_INTO_NULL <BR>Your program attempts
to assign values to the attributes of an
uninitialized <BR>(atomically null) object. </P>
<P>CASE_NOT_FOUND <BR>None of the choices in the
WHEN clauses of a CASE statement is selected,
and <BR>there is no ELSE clause. </P>
<P>COLLECTION_IS_NULL <BR>Your program attempts
to apply collection methods other than EXISTS to
an <BR>uninitialized (atomically null) nested
table or varray, or the program attempts <BR>to
assign values to the elements of an
uninitialized nested table or varray. </P>
<P>CURSOR_ALREADY_OPEN <BR>Your program attempts
to open an already open cursor. A cursor must be
closed <BR>before it can be reopened. A cursor
FOR loop automatically opens the cursor to
<BR>which it refers. So, your program cannot
open that cursor inside the loop. </P>
<P>DUP_VAL_ON_INDEX <BR>Your program attempts to
store duplicate values in a database column that
is <BR>constrained by a unique index. </P>
<P>INVALID_CURSOR <BR>Your program attempts an
illegal cursor operation such as closing an
unopened cursor. </P>
<P>INVALID_NUMBER <BR>In a SQL statement, the
conversion of a character string into a number
fails <BR>because the string does not represent
a valid number. (In procedural statements,
<BR>VALUE_ERROR is raised.) This exception is
also raised when the LIMIT-clause <BR>expression
in a bulk FETCH statement does not evaluate to a
positive number. </P>
<P>LOGIN_DENIED <BR>Your program attempts to log
on to Oracle with an invalid username and/or
password. </P>
<P>NO_DATA_FOUND <BR>A SELECT INTO statement
returns no rows, or your program references a
deleted element <BR>in a nested table or an
uninitialized element in an index-by table. SQL
aggregate <BR>functions such as AVG and SUM
always return a value or a null. So, a SELECT
INTO <BR>statement that calls an aggregate
function never raises NO_DATA_FOUND. The FETCH
<BR>statement is expected to return no rows
eventually, so when that happens, no
<BR>exception is raised. </P>
<P>NOT_LOGGED_ON <BR>Your program issues a
database call without being connected to Oracle.
</P>
<P>PROGRAM_ERROR <BR>PL/SQL has an internal
problem. </P>
<P>ROWTYPE_MISMATCH <BR>The host cursor variable
and PL/SQL cursor variable involved in an
assignment have <BR>incompatible return types.
For example, when an open host cursor variable
is passed <BR>to a stored subprogram, the return
types of the actual and formal parameters must
<BR>be compatible. </P>
<P>SELF_IS_NULL <BR>Your program attempts to
call a MEMBER method on a null instance. That
is, the <BR>built-in parameter SELF (which is
always the first parameter passed to a MEMBER
<BR>method) is null. </P>
<P>STORAGE_ERROR <BR>PL/SQL runs out of memory
or memory has been corrupted. </P>
<P>SUBs cript_BEYOND_COUNT <BR>Your program
references a nested table or varray element
using an index number <BR>larger than the number
of elements in the collection. </P>
<P>SUBs cript_OUTSIDE_LIMIT <BR>Your program
references a nested table or varray element
using an index number <BR>(-1 for example) that
is outside the legal range. </P>
<P>SYS_INVALID_ROWID <BR>The conversion of a
character string into a universal rowid fails
because the <BR>character string does not
represent a valid rowid. </P>
<P>TIMEOUT_ON_RESOURCE <BR>A time-out occurs
while Oracle is waiting for a resource. </P>
<P>TOO_MANY_ROWS <BR>A SELECT INTO statement
returns more than one row. </P>
<P>VALUE_ERROR <BR>An arithmetic, conversion,
truncation, or size-constraint error occurs. For
example, <BR>when your program selects a column
value into a character variable, if the value is
<BR>longer than the declared length of the
variable, PL/SQL aborts the assignment and
raises <BR>VALUE_ERROR. In procedural
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -