<small id='iiTSH'></small><noframes id='iiTSH'>

    <bdo id='iiTSH'></bdo><ul id='iiTSH'></ul>

<tfoot id='iiTSH'></tfoot>
<legend id='iiTSH'><style id='iiTSH'><dir id='iiTSH'><q id='iiTSH'></q></dir></style></legend>

  • <i id='iiTSH'><tr id='iiTSH'><dt id='iiTSH'><q id='iiTSH'><span id='iiTSH'><b id='iiTSH'><form id='iiTSH'><ins id='iiTSH'></ins><ul id='iiTSH'></ul><sub id='iiTSH'></sub></form><legend id='iiTSH'></legend><bdo id='iiTSH'><pre id='iiTSH'><center id='iiTSH'></center></pre></bdo></b><th id='iiTSH'></th></span></q></dt></tr></i><div id='iiTSH'><tfoot id='iiTSH'></tfoot><dl id='iiTSH'><fieldset id='iiTSH'></fieldset></dl></div>

      1. 如何创建一个 oracle sql 脚本假脱机文件

        How to create a oracle sql script spool file(如何创建一个 oracle sql 脚本假脱机文件)

        • <i id='eoN2R'><tr id='eoN2R'><dt id='eoN2R'><q id='eoN2R'><span id='eoN2R'><b id='eoN2R'><form id='eoN2R'><ins id='eoN2R'></ins><ul id='eoN2R'></ul><sub id='eoN2R'></sub></form><legend id='eoN2R'></legend><bdo id='eoN2R'><pre id='eoN2R'><center id='eoN2R'></center></pre></bdo></b><th id='eoN2R'></th></span></q></dt></tr></i><div id='eoN2R'><tfoot id='eoN2R'></tfoot><dl id='eoN2R'><fieldset id='eoN2R'></fieldset></dl></div>

          <small id='eoN2R'></small><noframes id='eoN2R'>

              <tbody id='eoN2R'></tbody>
          1. <tfoot id='eoN2R'></tfoot>
            <legend id='eoN2R'><style id='eoN2R'><dir id='eoN2R'><q id='eoN2R'></q></dir></style></legend>

                • <bdo id='eoN2R'></bdo><ul id='eoN2R'></ul>
                  本文介绍了如何创建一个 oracle sql 脚本假脱机文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个关于假脱机程序结果的问题.我的示例 sql 脚本如下所示.

                  I have a question about spooling the the results of my program. My sample sql script looks like this.

                    whenever sqlerror exit failure rollback
                    set heading off
                    set arraysize 1
                    set newpage 0
                    set pages 0
                    set feedback off
                    set echo off
                    set verify off
                  
                   declare
                   ab varchar2(10) := 'Raj';
                   cd varchar2(10);
                   a number := 10;
                   c number;
                   d number;
                   begin
                   c := a+10;
                   select ab,c into cd,d from dual;
                   end;
                  
                   SPOOL 
                   select cd,d from dual;
                   SPOOL OFF
                   EXIT;
                  

                  上面的脚本不起作用,但我想做这样的事情,在开始结束块中我们计算一些值,我想假脱机这些结果.

                  The above script does not work, but I want to do something like this where in the begin end block we compute some values and i want to spool those results.

                  谢谢.

                  推荐答案

                  这会将匿名块的输出假脱机到名为 output_<YYYYMMDD>.txt 的文件中,该文件位于本地的根目录中PC C:驱动器,其中 是当前日期:

                  This will spool the output from the anonymous block into a file called output_<YYYYMMDD>.txt located in the root of the local PC C: drive where <YYYYMMDD> is the current date:

                  SET SERVEROUTPUT ON FORMAT WRAPPED
                  SET VERIFY OFF
                  
                  SET FEEDBACK OFF
                  SET TERMOUT OFF
                  
                  column date_column new_value today_var
                  select to_char(sysdate, 'yyyymmdd') date_column
                    from dual
                  /
                  DBMS_OUTPUT.ENABLE(1000000);
                  
                  SPOOL C:output_&today_var..txt
                  
                  DECLARE
                     ab varchar2(10) := 'Raj';
                     cd varchar2(10);
                     a  number := 10;
                     c  number;
                     d  number; 
                  BEGIN
                     c := a+10;
                     --
                     SELECT ab, c 
                       INTO cd, d 
                       FROM dual;
                     --
                     DBMS_OUTPUT.put_line('cd: '||cd);
                     DBMS_OUTPUT.put_line('d: '||d);
                  END; 
                  
                  SPOOL OFF
                  
                  SET TERMOUT ON
                  SET FEEDBACK ON
                  SET VERIFY ON
                  
                  PROMPT
                  PROMPT Done, please see file C:output_&today_var..txt
                  PROMPT
                  

                  希望能帮到你...

                  在您评论后为游标的每次迭代输出一个值(我意识到在这个例子中每个值都相同,但您应该了解我正在做的事情的要点):

                  After your comment to output a value for every iteration of a cursor (I realise each value will be the same in this example but you should get the gist of what i'm doing):

                  BEGIN
                     c := a+10;
                     --
                     FOR i IN 1 .. 10
                     LOOP
                        c := a+10;
                        -- Output the value of C
                        DBMS_OUTPUT.put_line('c: '||c);
                     END LOOP;
                     --
                  END; 
                  

                  这篇关于如何创建一个 oracle sql 脚本假脱机文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                  How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                  Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                  Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                  Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                  Reset Sequence in oracle 11g(oracle 11g 中的重置序列)
                    <legend id='JAhv0'><style id='JAhv0'><dir id='JAhv0'><q id='JAhv0'></q></dir></style></legend>
                          <bdo id='JAhv0'></bdo><ul id='JAhv0'></ul>
                          <i id='JAhv0'><tr id='JAhv0'><dt id='JAhv0'><q id='JAhv0'><span id='JAhv0'><b id='JAhv0'><form id='JAhv0'><ins id='JAhv0'></ins><ul id='JAhv0'></ul><sub id='JAhv0'></sub></form><legend id='JAhv0'></legend><bdo id='JAhv0'><pre id='JAhv0'><center id='JAhv0'></center></pre></bdo></b><th id='JAhv0'></th></span></q></dt></tr></i><div id='JAhv0'><tfoot id='JAhv0'></tfoot><dl id='JAhv0'><fieldset id='JAhv0'></fieldset></dl></div>
                        • <small id='JAhv0'></small><noframes id='JAhv0'>

                            <tfoot id='JAhv0'></tfoot>

                              <tbody id='JAhv0'></tbody>