Is it possible the reel with the variable column size?

Hi, I'm queue to a CSV file with the following script (the SELECT real is different but similar, Oracle 10.2.0.3.0):
SET COLSEP ';'
SET FEEDBACK OFF
SET LINESIZE 2000
SET PAGESIZE 0
SET TERMOUT OFF
SET TRIMSPOOL ON
SET VERIFY OFF

SPOOL test.csv REPLACE

SELECT 'COLUMN1', 'COLUMN2', 'COLUMN3' FROM dual UNION ALL
SELECT 'value1', NULL, NULL FROM dual UNION ALL
SELECT 'value2', NULL, NULL FROM dual;

SPOOL OFF

EXIT SUCCESS COMMIT
Which produces the following output:
COLUMN1;COLUMN2;COLUMN3
value1 ;       ;
value2 ;       ;
Is it possible to get the following with the variable column size result
COLUMN1;COLUMN2;COLUMN3
value1;;
value2;;
I tried SET NULL "but I see no difference. Thanks in advance!

Markus

Hello

SQL * Plus you button the output so that each column has a fixed length, which is exactly what you don't want.

To get around this, concatenate all your data in a column VARCHAR2 fat with delimiters.

For example, instead of

SELECT    empno
,       ename
,       hiredate
FROM       scott.emp
;

Do something like

SELECT    empno
|| ';' || ename
|| ';' || TO_CHAR (hiredate, 'DD-Mon-YYYY')
FROM       scott.emp
;

Tags: Database

Similar Questions

  • How to use the command the reel with Bind Variables

    For the next REEL, I want the GEN_DATE to be entered by the user at the time of execution of the SQL Script. Is this possible in the command of the COIL.


    the colsep value,-separate the columns with a comma
    set pagesize 1000 - get rid of disturbing - between pages
    set position-the title of column Print
    Set trimspool on - remove the spaces to the right. eliminating spaces until eol
    set linesize 700 - line size should be the sum of the column width
    coil spool_results.csv
    SELECT *.
    OF GUI_SITE_JOURNAL
    WHERE GENDATE_ BETWEEN ' 2012-11-01 00:00:00:00000' AND ' 2012 - 11 - 02 00:00:00:00000'* ORDER BY GEN_DATE;
    spool off;

    The reason is to give the opportunity to the user so that he can enter any beach without changing the code of the script.

    Can someone help me please.

    Published by: user10903866 on February 18, 2013 19:44

    Hello

    user10903866 wrote:
    For the next REEL, I want the GEN_DATE to be entered by the user at the time of execution of the SQL Script. Is this possible in the command of the COIL.

    Do you want user input in the command of the COIL, or want you she in the query?

    the colsep value,-separate the columns with a comma
    set pagesize 1000 - get rid of disturbing - between pages
    set position-the title of column Print
    Set trimspool on - remove the spaces to the right. eliminating spaces until eol
    set linesize 700 - line size should be the sum of the column width
    coil spool_results.csv
    SELECT *.
    OF GUI_SITE_JOURNAL
    WHERE GENDATE_ BETWEEN ' 2012-11-01 00:00:00:00000' AND ' 2012 - 11 - 02 00:00:00:00000'* ORDER BY GEN_DATE;

    What are the data type gen_date of the oif?
    If it is a string, it is a big mistake. Information about the dates in the DATE columns belongs.
    If it's a DATE, so don't try to compare strings, such as "2012-11-01 00:00:00:00000'."

    spool off;

    The reason is to give the opportunity to the user so that he can enter any beach without changing the code of the script.

    Can someone help me please.

    One way to do that is with substitution variables:

    ...
    SET     VERIFY  OFF
    
    ACCEPT  start_gen_date     PROMPT "Starting date (e.g., 2013-02-18 23:00:00.00000): "
    ACCEPT  end_gen_date     PROMPT "Ending date   (e.g., 2013-02-18 23:59:59.99999): "
    
    SPOOL  spool_results.csv
    
    SELECT    *
    FROM        gui_site_journal
    WHERE        gen_date  BETWEEN '&start_gen_date'
                    AND     '&end_gen_date'
    ORDER BY  gen_date;
    
    SPOOL  OFF
    

    There are security considerations. Variables substitution to the devious users the power to issue a SQL, such as DROP TABLE command. Users with SQL * Plus access already have this power, anyway.

  • bind the variable column of v$ sqlarea

    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for HPUX: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    select to_char(sql_fulltext), bind_data from v$sqlarea where sql_id = '5fwm73ndv5pjp';
    TO_CHAR(SQL_FULLTEXT)                    BIND_DATA
    select vgal.GAFS_DISPLAY_LINE_CD
    from view_gafs_account_line vgal
     where vgal.ACCOUNT_ID =  :p1 and
     vgal.ACCOUNT_LINE_SEQ_CD =  :p2 and 
    vgal.ACCOUNT_TYPE_ID =  :p3 and 
    vgal.PROGRAM_SUMMARY_ID =  :p4     
    I'm not horribly v$ sqlarea. but there were some questions about the application executes a query and get
    no row is returned.

    I find the query in v$ sqlarea but I would like to know what are bind variables, but this column is null.

    This means that the query has been run with null for all bind variables?
    or bind variables not seized for any reason are any?

    v$ sql_bind_capture I bind the value of the variable

    SELECT
       a.sql_text,
       b.name,
       b.position,
       b.datatype_string,
       b.value_string
    FROM
    
      v$sql_bind_capture b,
    
      v$sqlarea          a
    
    WHERE
    
       b.sql_id = 'dpf3w96us2797'
    
    AND
       b.sql_id = a.sql_id;
    
  • A better way to treat the form as a table with the variable column type?

    I wanted to make a column to return according to the status of a flag column as readonly. I have a column defined as follows in the report query.

    Decode (sys_flag, 'Y', APEX_ITEM. DISPLAY_AND_SAVE 3, TYPE_CODE, APEX_ITEM. SELECT_LIST_FROM_LOV (3, TYPE_CODE, 'LOV_TYPE_CODE_LOV')) AS TYPE_CODE

    To get the SRM process noting that column, I had to put this 'band of HTML code' to 'No', then the column attributes, I put:
    "Expression HTML" to "#TYPE_CODE #
    ' Display under "to"text display (saves the State).

    And then it took me to get new lines of work:
    "Default of Type" to "Expression of PL/SQL.
    'Default' to APEX_ITEM. SELECT_LIST_FROM_LOV (3, NVL(:P18_TYPE_CODE,'LOV_TYPE'), NULL, 'LOV_TYPE_CODE_LOV', ' NO')

    This makes large, however submit that it seems that the checksum of line used by MRU included the raw HTML generated by the APEX_ITEM package and not just the value of the column. I worked around this by including an element hidden checksum and creating a process that replaces the checksum generated automatically with my custom.

    Is there a better way to intercept this checksum, preferably before it is rendered on the page? I now hide the sum of hidden HTML control in the output HTML of another column, so it's a bit ugly. If not, is there an easier way to achieve what I'm looking for? I tried several combinations, and it seems to work better. It's just a shame there's no way to have a standard hidden column included in the SRM process.

    Hello

    I tried different possibilities and seems to run the following:

    Create a report questioning in NORMAL SQL function to help:

    SELECT
    APEX_ITEM.HIDDEN(1,EMPNO) || APEX_ITEM.TEXT(2,ENAME) ename,
    CASE WHEN DEPTNO = 10 THEN
     APEX_ITEM.HIDDEN(3, SAL) || SAL
    ELSE
     APEX_ITEM.TEXT(3, SAL)
    END SAL,
    EMPNO,
    DEPTNO || APEX_ITEM.MD5_CHECKSUM(ENAME, SAL) DETPNO
    FROM EMP
    

    Do not specify something special for column definitions.

    Create a button that submits the page.

    Create a PL/SQL process that runs "On submit - after calculations" and Validations, triggered by this button and using the following code:

    BEGIN
    APEX_ITEM.MULTI_ROW_UPDATE('#OWNER#:EMP:EMPNO,1:,|ENAME,2:SAL,3');
    END;
    

    I've done here: http://htmldb.oracle.com/pls/otn/f?p=55041:35

    Any element with the value of DEPTNO 10 has the value SAL, read-only, as otherwise it's editable. This is done by creating a hidden input field for the actual value, followed by the text version OR by creating a single entry field. This ensures that we have the correct number of SAL elements on the page.

    APEX_ITEM. MULTI_ROW_UPDATE is the "manual" version of the MRU that you would normally get with a form of table and works for above normal as sql based query reports. The format of this very strict is that you must always allow for two primary keys. See the text of presentation here: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b32258/api.htm#CHDFDACC

    Andy

  • name of the variable column for a source

    Can I have a column name variable for a text box, such as this one source

    Select (: P2_column_name) of the budget where id =: P2_id;

    I get the: P2_column_name variable and not really the content of the column.
    what I am doing wrong, thank you, Doug

    Only works for reports. It sounded like you want to select in a correct form, update the value and then present at the table element?

    Thank you

    Tony Miller
    Webster, TX

    I cried because I don't have an office with a door until I met a man who had no cubicle.
    -Dilbert

    If you answer this question, please mark the thread as closed and give points where won...

  • The Variables columns in a cursor

    Hi all.

    I have a Table that I don't know the structure.
    So I have a vision that shows me the structure of my table, but when I try to compile I can not, because the compiler identifies that a certain column isn & rsquo; t in my structure.
    Could someone help me?

    My code is:

    declare
    .. NUMBER;

    .. cursor CTABLE::OPEN is
    .. SELECT *.
    .. TABLE
    .. UPDATE;

    Start
    .. FOR reg_Table IN CTable::open LOOP

    -I have a vision that shows me the columns in my table
    -If the Column1 and Column2 it do not use the structure of the Table, they do not compile.

    .. IF (VIEW. COLUMN1 = S ') THEN
    .. : = reg_Table.Column1;
    .. ON THE OTHER
    .. : = 0 ;
    .. END IF;


    .. IF (VIEW. COLUMN2 = S ') THEN
    .. : = reg_Table.Column2;
    .. ON THE OTHER
    .. : = 0 ;
    .. END IF;
    end;

    Thank you.

    You must use dynamic sql statements. But you would still have the problem to know and be able to define the columns found/used in the tables, that you insert. For example, table1 has two columns, but table2 has four columns. How you build the insert statement. It can be done, but as I said it must be done using dynamic sql.
    Here's a start

    declare
     v_sql    varchar2(2000);
     type C_RefCURSOR ref cursor;
     c_cursor C_RefCURSOR;
     v_col_seq number :=1;
    begin
      v_sql := 'select ' ;
      for C1 in select * from YOUR_VIEW where table_name = "YOUR TABLE" LOOP
         v_sql := v_sql || C1.Column_name || ' as Col'||v_col_seq||', ' ;
      end loop;
      v_sql := substr( v_sql , 1, length (v_sql)-1) || ' from YOUR TABLE' ;
      OPEN c_CURSOR FOR V_SQL;
      LOOP
          fetch c_cursor ...
    
  • Combing of string to the variable

    Hello

    I am sure I have done this before but don't remember the code.

    I want to combine the result of a query to search for another.

    Here's what I mean:

    The variable purchasedpro.size is s, m, l or xl (for clothing)

    < cfset therealsize = #purchasepro.size # >

    "< name cfquery ="getquantity"datasource =" "#" username = "#" password = "#" >
    SELECT #therealsize #.
    PRODUCTS
    WHERE int_ProductID = #purchasepro.int_ProductID #;

    < / cfquery >

    < cfset size = "getquantity. #purchasepro.size #">"

    < cfset newquantity = #thesize #-#purchasepro.int_Quantity # >
    "< name cfquery ="updateitems"datasource =" "#" username = "#" password = "#" >
    UPDATE products
    SET #purchasepro.size # = "#newquatity #
    WHERE int_ProductID = ' #purchasepro.int_ProductID # ';
    < / cfquery >


    So if'm '(for medium) is defined as the realsize, am the coloum' lies in the products table, and then the value of'm ' is out to change.

    I'm sure this is to do with the combination "getquantity. #purchasepro.size #"but I don't remember how."

    Please can someone help

    Daverns goes in the right direction... but...

    Beware that this automatically select the first line of the query would return, if the query returns multiple rows, you will need to use cfloop to get additional values

  • How to trace the greatness of the variables compared to the timestamp with evenly spaced samples in time?

    Hello world. I need to trace the variable amplitudes compared to the timestamp (date and time), but the time intervals between samples are not equidistant. In my area, this is called trend plot. I'm surprised that Labview does not a vi to do this. The only solution that I found so far is to save the data in an Excel file and open this chart in Excel because it has the ability to trace what that this is against what whatsoever is not limited to something as even spaced samples. How to achieve this is Labview? A graph of waveform vi would be perfect if it was not by the fact that it works with even spaced samples.

    Thank you.

    Paulo Siqueira

    Your requirement is directly possible with LabVIEW.

    You can spend time to understand the difference between 'Chart', 'Graph' and "Graph XY".

    VI attached is drawing samples of unequal time.

    Hint:-right click on the 'XY' graph-> properties-> display-> 'Axis of X' = absolute time Format

    Kind regards

    Yogesh Redemptor

  • Adjust the data in the database with the variables

    Hello

    For my internship, I have an assignment to read and set a database with the variables. This SQL server 2005 database contains variables of a controller. These are read and write variables. The assignment is to display the read variables and the user can adjust the variables of Scripture. The first part was "easy" because the forum contained a lot of examples of this. The second part is more difficult because the forum contains absolutely no example of this. Can I use LabVIEW 2010 and 2011, and also I downloaded the 30 day trial of the database connection tool. If it's useful, I can recommend my company to buy this package. Playback vi makes use of a UDL (Microsoft data link) connection.

    So you guys my question is: is it possible to adjust the specific variables in a database using LabVIEW? And maybe you can give me a little advice on this topic...

    Thanks in advance!

    Roy

    In SQL, the specific data are always selected with the keyword WHERE. In VI to update there is a link for options, you can for example add a constant 'WHERE id = 1457 and measure > 0.54 ".

    You can ofc. also build this chain through controls, settings and other means.

    If you prefer, you can use the Execute Query (under Advanced tab I think) to which you can send the complete query example "TestTable Update set name ="Zeus"where id > 14 and id.<>

    /Y

  • Is it possible to rename the variable loop for I?

    I do a lot of work with 2D arrays.  Sometimes, it would be useful when browsing the tables for one of the index named i and the other named j.  Is it possible to change the name of the variable increment other than what actually in another variable?

    Thnaks.

    Hummer1,

    As already said, there is no way to change the image of the final iteration.  However, you can add a description to the wire.  Click with the right button on the wire, then select "Description and Tip", type the name/description you want in the box.  Now you can move your mouse over the wire, and the description will appear in the context-sensitive Help window.  I hope this helps.

    Chris M

  • Using XQuery with PL/SQL, link the Variable

    I am only able to find an example of use of xquery with pl/sql.

    [http://www.comp.dit.ie/btierney/oracle11gdoc/appdev.111/b28369/xdb_xquery.htm#CBAEEJDE]

    Why is what they show only using bind variables? It's the only way it should be used, it provides a performance gain more simply by using the crossing clause and a passing beam a PL/SQL variable? I'm looking to implement a solution for my company using Xquery in PL/SQL. I am concerned that these procedures will be called during a flow of the user interface and performance it must be as soon as possible.

    A PL/SQL variable, column, or the output of another operation would be all be equivalent to a connection variable that PL/SQL compilation is concerned. Which would be bad practice would be to build in XQuery with the predicate hardcoded in the XQuery operation whenever the XQuery query has been run.

  • Possible to change the variable cpQuizInfoPassFail through advanced actions?

    Is it possible to change the variable cpQuizInfoPassFail through advanced actions? I do not see this or the other quizzing variable when I try to create an advanced action and change by entitlement or expression. Let me explain what I want to accomplish, I ask the wrong question. I have a training project, with that I need to include a post test. I don't really like the captivate quizzes. I want the post-test to play as a ride on jeopady where the user chooses issues category and gets points if the user answers correctly. For this I must ask questions on a game board and (from what I can fig) you cannot have multiple questions on the same page. I'm building the quiz with my own custom variables and coded so that the program jumps to a page of the certificate if the user gets more than 84 points. THA all works very well. But I have to be able to tell the database that the program will connect with the user has passed the quiz. I thought I could do this if I assign the value 1 to the variable cpQuizInfoPassFail. Is there a way to do this? Thanks in advance for any help,

    Doug Jackson

    Hi Doug,.

    I don't see the version you are using. Each interactive object can be marked, has a report following properties in the control panel (if you use CP5 or CP5.5) or a tab in the Properties dialog box reports, if you use a different version. You must add a score (default value is normally 1 point) and make sure you add it to the total score.

    If you want to make me a glance, post your file on acrobat.com (free, use your Adobe ID), share and publish. You will have a link that you can copy into a private message to me.

    Lilybiri

  • the filter value (with presentation variables) for applications using "SQL issued.

    If I have a "emitted SQL":


    SELECT saw_0 saw_0, saw_1 saw_1, saw_2 saw_2, saw_3 saw_3, saw_4 saw_4 (FROM)
    SELECT saw_0 saw_0, saw_1 saw_1, SUM (saw_2) saw_2, SUM (saw_3) saw_3 SUM (saw_4) saw_4
    Of
    (
    (
    SELECT 'period '. "" YearMonth "saw_0,"Customer. " "" CustomerName "saw_1, COUNT ('dirty'. ("' SalesDate") saw_2, "Sales". "' No.OfConsumer ' saw_3, saw_4 0
    CRM
    WHERE ('period'. ("' YearMonth" > = 200904) AND ('period'. ("' YearMonth" < = 200910)
    )
    UNION ALL
    (
    SELECT 'period '. "" YearMonth "saw_0,"Customer. " "" CustomerName "saw_1, saw_2 0, saw_3 0, Count ("SuperSales". "Saw_4 SuperSalesDate") "
    CRM
    WHERE ('period'. ("' YearMonth" > = 200904) AND ('period'. ("' YearMonth" < = 200910)
    )
    ) t1
    Saw_0 GROUP, saw_1
    ORDER BY saw_0, saw_1
    ) t2 ORDER BY saw_0


    in fact, in this application, I would like to set up a filter to 'period '. "" YearMonth "using the variable of presentation.
    is it possible to do?
    Thank you!!

    Hi Forreging,

    You can use variables of the presentation, but not if you directly set the SQL via the Advanced Options tab.

    Instead, build up the first report like the first part of the statement of the UNION. Then use the "combined with a similar request" to build the logic for the second part of the query.

    When approached in this way, you can set filters on each "subquery" via the criteria in other tab, OBIEE allows you to add an external to the level of the query filter when you go on the road to the SQL code in the Advanced tab.

    Good luck and if you find this post useful, please give points!

    Best regards

    -Joe

  • The possibility of declaring the variable on request?

    Hello

    With the help of Oracle 9i. I'm new to the PL/SQL (coming from c#), I would like to know if it is possible to declare a variable around the where it is used. For example, in the execution of the procedure block, suppose I want to do:

    .. existing code...

    vTest whole;
    vTest: = 123;

    .. existing code (continued)...

    In doing so, the procedure could not compile. The only way I know to date is to declare the whole vTest. in the declaration block. Can you please let me know how to declare the variable in the body of the procedure?

    Thanks in advance.

    It is technically possible, but I wouldn't recommend it (I personally do not like this approach a LOT).

    ME_XE?create or replace procedure testin  2  as  3  4     vparamone   number default 123;  5  6  begin  7  8     declare  9        vparamtwo   number default 456; 10     begin 11        vparamone   := vparamtwo; 12     end; 13     dbms_output.put_line(vparamone); 14  end; 15  /
    
    Procedure created.
    
    Elapsed: 00:00:00.29ME_XE?exec testin;456
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01ME_XE?
    
  • To compare the name of the control with a variable

    Hi all

    I want to compare the name of a control with a variable in a loop. Is there any function for it in Labview? Please let me know if it is.

    Thanks in advance


Maybe you are looking for