[转载]PL/SQL DEVELOPER中的专用复制(Special Copy)
<p>信息来源: <a href="http://blog.csdn.net/yzsind/">[url]http://blog.csdn.net/yzsind/[/url]</a></p><p align="center"><font size="2">--摘自PL/SQL DEVELOPER6.0的中文PDF帮助手册</font></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">如果你正在用<span lang="EN-US"> PL/SQL Developer </span>写<span lang="EN-US"> SQL </span>和<span lang="EN-US"> PL/SQL </span>代码,随后你又要在其它工具里使用代码,例如象<span lang="EN-US"> 3GL </span>这样的程序设计语言,那么你可能需要把这些代码转换为稍微不同的格式。让我们假设你已经在<span lang="EN-US"> PL/SQL Developer </span>里写了并测试了这样一个<span lang="EN-US">SQL </span>语句:<span lang="EN-US"><p /></span></span></p><blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span><font size="1"><strong>select deptno, sum(sal) mgr_sal from emp<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><font size="1"><strong><span>where job = </span><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">'MANAGER'<p /></span></strong></font></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span><font size="1"><strong>group by deptno<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span><font size="1"><strong>order by mgr_sal desc<p /></strong></font></span></p></blockquote><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">例如,如果你要在<span lang="EN-US">Borland Delphi </span>里使用这个语句,你可能需要象这样的格式:<span lang="EN-US"><p /></span></span></p><blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>SQL := 'select deptno, sum(sal) mgr_sal from emp' + #13#10 +<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>'where job = ''MANAGER''' + #13#10 +<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>'group by deptno' + #13#10 +<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>'order by mgr_sal desc';<p /></strong></font></span></p></blockquote><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">为了这个目的,在右击了编辑器里的一个选择后,你可以使用来自于</span><em><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体,Italic; mso-bidi-font-family: '宋体,Italic'; mso-font-kerning: 0pt">编辑</span></em><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">菜单或来自于弹出式菜单的</span><em><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体,Italic; mso-bidi-font-family: '宋体,Italic'; mso-font-kerning: 0pt">专用复制</span></em><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">功能。这个功能有一个子菜单,它显示了所有被定义的专用复制格式。在选择了格式之后,被转换的代码就被储存在剪贴板上了,这样你就可以粘贴它到相应工具的编辑器里了。专用复制格式被定义在<span lang="EN-US"> PL/SQL Developer </span>安装目录下的<span lang="EN-US"> SpecialCopy </span>子目录里。你可以改变预先确定的复制格式或者添加新的复制格式。仅仅简单地添加一个带有<span lang="EN-US"> .copy </span>扩展名的文本文件就可以了,它包含了一个针对<span lang="EN-US"> PL/SQL </span>代码第一行的变量(<span lang="EN-US"><line_1></span>)、一个针对<span lang="EN-US"> PL/SQL </span>代码最后一行的变量(<span lang="EN-US"><line_N></span>)和一个针对所有其它行的变量(<span lang="EN-US"><line_*></span>)。下面是一个针对<span lang="EN-US"> Borland Delphi </span>的例子:<span lang="EN-US"><p /></span></span></p><blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>;PL/SQL Developer SpecialCopy definition for Borland Delphi<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>;<line_1> for first line<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>;<line_*> for all other lines<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>;<line_N> for last line<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>;<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>SQL := '<line_1>' + #13#10 +<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>'<line_*>' + #13#10 +<p /></strong></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><font size="1"><strong>'<line_n>';<p /></strong></font></span></p></blockquote><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">第一行需要为指派到<span lang="EN-US"> SQL </span>的变量加上前言,接下来需要有一个<span lang="EN-US"> CR/LF </span>对。最后一行不需要有<span lang="EN-US">CR/LF </span>对,但需要用分号来终止。所有其它行仅仅需要<span lang="EN-US"> CR/LF </span>接在后面。如果<span lang="EN-US"> <line_1> </span>和<span lang="EN-US"> <line_n> </span>都与<span lang="EN-US"> <line_*> </span>一样,你可以忽略它们。在一些语言里,你需要对特定的字符使用换码序列。例如,在<span lang="EN-US"> C++ </span>里,你要对<span lang="EN-US"> tab</span>字符(<span lang="EN-US">ASCII </span>码为<span lang="EN-US"> 9</span>)使用<span lang="EN-US"> \t </span>。要定义这些换码序列,请使用<span lang="EN-US"> #define </span>关键词:<span lang="EN-US"><p /></span></span></p><blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><strong><font size="1">#define char(9) = \t<p /></font></strong></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><strong><font size="1">#define \ = \\<p /></font></strong></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><strong><font size="1">String("<line_1>\n") +<p /></font></strong></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><strong><font size="1">String("<line_*>\n") +<p /></font></strong></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-para-margin-left: 1.0gd" align="left"><span lang="EN-US" style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><strong><font size="1">String("<line_n>");<p /></font></strong></span></p></blockquote><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">你还可以使用 “<span lang="EN-US">#define compress</span>” 来指出你要从结果里移除所有多余的空字符(空格、制表符和换行)。<span lang="EN-US"><p /></span></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">注意,<span lang="EN-US">.copy </span>文件的名字将被包括在菜单里,所以你应该使用描述性的文件名。</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><p /></span></p>页:
[1]
