Count number of columns in query passed as PLSQL parameter

Hi All,
I am using a PLSQL package to generate excel file in a Database directory, to generate file i am passing sql query and number of columns manually in a parameter.
Now i want to automate it and do not want to pass "Number of Columns" as parameter.
HOW CAN I CALCULATE NUMBER OF COLUMNS IN PASSED QUERY.
Note: query can contain functions ( to get description or any other data)
Many Thanks in advance

http://saubbane.blogspot.com/2011/01/how-to-find-column-count-of-query.html
Along with Re: Dynamic Fetch on dynamic Sql and just below this post, Blushadow's original run_query (from which I nicked!).

Similar Messages

  • How to count number of columns in cross-tab report

    I have created a cross-tab report and have managed to get the data out as below:
                 Jan     Feb     Mar....(display of months will auto expand) Avg/Mo  Total
    UserA     4          3        4                                                                         11
    UserB     6          1        1                                                                          8
    UserC     5          5        5                                                                         15
    Total       15        9        10                                                                        33 
    I want to insert a calculated column (Avg/Mo) into the cross-tab report based on the formula: Total/Number of Months. I used this calculation formula  for Avg.Mo column:
    (GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/GetNumColumns)
    However, I get the wrong average since GetNumColumns count the total number of columns including the column of Avg/Mo and Total.
    How do i get the number of columns, excluding the Avg/Mo calculated column and Total column?
    PS: I can't use hardcode since the number of months/columns will auto expand the months progress...
    Edited by: jutamind on May 26, 2010 9:27 AM

    ok managed to solve this by slightly changing the formula:
    GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/(GetNumColumns-2)

  • SSIS: Count number of columns

    Hi,
    I am processing flat files and I want to make sure that my files will contain the number of columns I expect, because a user might some day input a file with a new column format. If the file does not contain the correct number of columns, process must stop.
    I am planning to input the expected of columns in a User Variable.
    But how do I test for the number of columns in the file, and do I stop the execution?
    Be precise please (do I work in the control flow? in the Data flow?).
    Thanks in advance.
    Paul

    Dear Pauldube
    I think Arthurz is right
     (1) First
     take  one package level variable for storing length of Header row of each and every file
    Eg.         
    Variable Name = FileRowLen
    Variable Type = Integer
    (2) Take one script task and Add FileRowLen
     variable to readwritevariables then edit script
    Add below code :
    Dim FileRowStack as string()
    FileRowStack = System.IO.File.ReadAllLines(FileSource)
    ‘–File source is string variable contain filepath that you want to import
    Dts.variables(“FileRowLen”).value = FileRowStack(0).length
    (3) Now open precedence constraint editor then
    Eveluation operation :  Expression
    Expression  :  @FileRowLen =
     -- Header length of file which would you like to process
    Multiple constraints : Logical or….
    Press OK
    Connector will looks
     like ----------------
    Ramesh Rathod

  • DVWP XSLT count number of column having Yes/No values for each row

    I have a Data View Web Part .Now I have a column that contains either 'Yes' or 'No'
    and i want to count the number of 'Yes' for the rows and column  .
    below image will help to understand better what i am tying to achieve.  

    Here is XSLT code , you may find this usefull
    Row View Template :
    <xsl:template name="dvt_1.rowview">
          <xsl:param name="Rows"/>
          <xsl:variable name="CountYesForAll" select="number((. = contains(@Richard,'Yes')))
           +number((. = contains(@AndrewP,'Yes')))
           +number((. = contains(@Damien,'Yes')))
           +number((. = contains(@AndrewC,'Yes')))
           +number((. = contains(@Tiffany,'Yes')))
           +number((. = contains(@David,'Yes')))
           +number((. = contains(@Tony,'Yes')))
           +number((. = contains(@Saj,'Yes')))
           +number((. = contains(@Miguel,'Yes')))
           +number((. = contains(@Viv,'Yes')))
           +number((. = contains(@Paula,'Yes')))
           +number((. = contains(@Helen,'Yes')))
           +number((. = contains(@Matthew,'Yes')))"/>
          <xsl:variable name="RichardsCount" select="count($Rows[(@Richard)='Yes'])"></xsl:variable>
          <xsl:variable name="AndrewPsCount" select="count($Rows[(@AndrewP)='Yes'])"></xsl:variable>
          <xsl:variable name="DamiensCount" select="count($Rows[(@Damien)='Yes'])"></xsl:variable>
          <xsl:variable name="AndrewCsCount" select="count($Rows[(@AndrewC)='Yes'])"></xsl:variable>
          <xsl:variable name="TiffanysCount" select="count($Rows[(@Tiffany)='Yes'])"></xsl:variable>
          <xsl:variable name="DavidsCount" select="count($Rows[(@David)='Yes'])"></xsl:variable>
          <xsl:variable name="TonysCount" select="count($Rows[(@Tony)='Yes'])"></xsl:variable>
          <xsl:variable name="SajsCount" select="count($Rows[(@Saj)='Yes'])"></xsl:variable>
          <xsl:variable name="MiguelsCount" select="count($Rows[(@Miguel)='Yes'])"></xsl:variable>
          <xsl:variable name="VivsCount" select="count($Rows[(@Viv)='Yes'])"></xsl:variable>
          <xsl:variable name="PaulasCount" select="count($Rows[(@Paula)='Yes'])"></xsl:variable>
          <xsl:variable name="HelensCount" select="count($Rows[(@Helen)='Yes'])"></xsl:variable>
          <xsl:variable name="MatthewsCount" select="count($Rows[(@Matthew)='Yes'])"></xsl:variable>
      <tr>
       <xsl:if test="position() mod 2 = 1">
        <xsl:attribute name="class">ms-alternating</xsl:attribute>
       </xsl:if>
       <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
        <td class="ms-vb" width="1%" nowrap="nowrap">
         <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
        </td>
       </xsl:if>
       <td class="ms-vb">
        <xsl:value-of select="@Title"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Richard) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Richard"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@AndrewP) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@AndrewP"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Damien) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Damien"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@AndrewC) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@AndrewC"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Tiffany) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Tiffany"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@David) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@David"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Tony) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Tony"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Saj) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Saj"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Miguel) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Miguel"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Viv) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Viv"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Paula) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Paula"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Helen) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Helen"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Matthew) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Matthew"/>
       </td>
       <td>
       <xsl:value-of select="$CountYesForAll"/>
       </td>
       <td>
        <xsl:if test="normalize-space(@Title) = 'Richard'">
         <xsl:value-of select="$CountYesForAll + $RichardsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Andrew P'">
         <xsl:value-of select="$CountYesForAll + $AndrewPsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Damien'">
         <xsl:value-of select="$CountYesForAll + $DamiensCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Andrew C'">
         <xsl:value-of select="$CountYesForAll + $AndrewCsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Tiffany'">
         <xsl:value-of select="$CountYesForAll + $TiffanysCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'David'">
         <xsl:value-of select="$CountYesForAll + $DavidsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Tony'">
         <xsl:value-of select="$CountYesForAll + $TonysCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Saj'">
         <xsl:value-of select="$CountYesForAll + $SajsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Miguel'">
         <xsl:value-of select="$CountYesForAll + $MiguelsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Viv'">
         <xsl:value-of select="$CountYesForAll + $VivsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Paula'">
         <xsl:value-of select="$CountYesForAll + $PaulasCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Helen'">
         <xsl:value-of select="$CountYesForAll + $HelensCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Matthew'">
         <xsl:value-of select="$CountYesForAll + $MatthewsCount"/>
        </xsl:if>
       </td>
      </tr>
     </xsl:template>
    Footer template to show sub total :
    <xsl:template name="dvt_1.footer">
      <xsl:param name="Rows" />
      <div class="bupareport">    
        <table border="0" width="100%" cellpadding="2" cellspacing="0">
       <tr>
        <td width="8%">Sub Total :</td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Richard)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@AndrewP)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Damien)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@AndrewC)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Tiffany)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@David)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Tony)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Saj)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Miguel)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Viv)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Paula)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Helen)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Matthew)='Yes'])" /></td>
        <td width="6%"> </td>
        <td width="8%"> <xsl:value-of select="@AndrewP"> </xsl:value-of></td>
       </tr>
      </table>
      </div>
     </xsl:template>

  • Number of columns in query form

    I have an <af:query> component from a View Criteria. In the design it says "No search fields added." I have 10 query fields. I want to display 3 columns, with 4,2,4 fields respectively. If I set the property "Rows" to 3, it displays 4,4,2 fields in the three columns. Is there a way to achieve 4,2,4?
    I'm using JDeveloper 11.1.1.5.0

    I went into 'Set Source Order', but there are some non-transient attributes that were generated from the SQL query -- they cannot be moved up or down. I want to move some of them below some transient attributes at the bottom. Is this possible?

  • SSIS OLE DB Source in Data Flow Task calling SP that returns variable number of column as output

    We have one old Stored Proc that I need to reuse. But that stored proc returns different number of Columns as output depending on input Parameter. Say, if I pass 1 to 9 it will return 'ID', if i pass 10 to 33 it will return 'ID', 'Name',  if I pass
    34 to 51 it will return 'ID', 'Name', 'DefaultPosition' 
    In this way.
    Now I wanted to use this in OLE DB Source in SSIS DFT. 
    During that time immediately it is picking all possible columns in Available External Columns. Even if I manually select/delete those, package is failing at Runtime, because in Runtime the parameter this will get, it should always return one & only one
    column which is ID. [Because in this package I will only have to pass parameters like, 1 or 2 or 5 or 7 or 9.
    Which in every  case should return only ID from stored proc.
    Any Idea how I can get this please?
    Regards, Avik M.

    Has any one tried something like it? Could you please provide me a sample if you have done it.
    I tried these options but always got errors as
    [usp_return [64]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E55.An OLE DB record is available.  Source:
    "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E55  Description: "Column does not exist.".
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "usp_return" (64) returned error code 0xC0202009.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning
    of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
    ~ Thank you so much
    Regards, Avik M.

  • Count the number of columns return in an user-input sql query

    I need to do something like this
    I let an user input a sql query and then execute it
    assuming the sql query is always correct, it will return a Resultset
    then a table will pop up to accomodate the number of columns the resultset will produce
    i'm stuck at the part on how to check how many columns of data will be return in the resultset

         ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
         ResultSetMetaData rsmd = rs.getMetaData();
         int numberOfColumns = rsmd.getColumnCount();

  • Count column in query

    Hi all,
    I work with forms 6i and database oracle 8. I want to know if it's possible to count the number of column in a sql query. For exemple, i have : "select id, name, dtbirth from table". In this query, I have 3 column. But I don't know how can I get it! Someone can help me! please!
    best regards.

    You are in the wrong forum, try the database forum.
    Steven Davelaar,
    JHeadstart Team.

  • How can I find number of columns in a table using a query

    Hi
    I want to find the number of columns in a table using a query.
    Any help in this regard is much appreciated.
    Cheers

    Hi,
    This is the output i get when i executed ur query
    OWNER     OBJECT_NAME     OBJECT_TYPE
    SMLDBO     T2311_SURVEY_QUESTIONS     TABLE
    select OWNER,OBJECT_NAME,OBJECT_TYPE
    from all_objects
    where OBJECT_NAME = 'T2311_SURVEY_QUESTIONS';
    works Fine.
    But if i use the below query it returns : 0
    SELECT count(*) FROM user_tab_columns
    WHERE table_name =upper( 'T2311_SURVEY_QUESTIONS');
    What could be problem.
    The table exists + name of the table is correct + it resides in my schema itself.
    Any guess !!!

  • SQL query to count number of VMs

    In OVM 2.2 I could run a SQL query against the OVM database to count the number of VMs that I had created, for automated reporting purposes.
    I've looked at the 3.1 OVM database and it looks like most of the data is kept in BLOB columns. So does anyone know how I might query the 3.1 database to count the number of VMs?
    Thanks.

    Hi,
    Combine the relevant data from the three tables (using UNION ALL) in a sub-query. without the GROUP BY.
    Your main query can select from the sub-query's result set, as if it were a table. Do the GROUP BY in the main query.
    That is:
    WITH     u     AS
         SELECT     TO_CHAR (emp_start, 'YYYY') AS yr     FROM     Adminstaff
        UNION ALL
         SELECT     TO_CHAR (emp_start, 'YYYY') AS yr     FROM     Clerk
        UNION ALL
         SELECT     TO_CHAR (emp_start, 'YYYY') AS yr     FROM     ITstaff
    SELECT     COUNT (*)      AS cnt
    ,     yr
    FROM     u
    GROUP BY     yr
    ORDER BY     cnt     DESC
    ;Since empno is the primary key, it's easier not to mention empno at all in the sub-query, and use "COUNT (*)" instead of "COUNT (empno)" in the main query. The results are the same.
    It might be a little more efficient to GROUP BY in all three branches of the sub-query, and then to SUM the results in another GROUP BY in the main query. That means more code, of course, which I'll leave as an exercise for you.
    Why do you have three separate tables? I can understand that nobody else wants to be near the IT Staff, but it seems like lots of things (including this job) would be a lot simpler if all employees were all in one table, with a column to designate to which group (Adminstaff, Clerk or ITStaff) each one belongs.

  • Query to know number of columns in a table

    please can anyone suggest me a query to know number of columns in a table i.e.
    if I want to know how many number of colums are present in a specific table then what would be the query
    Message was edited by:
    user625519

    Give this a shot:
    SELECT table_name,count(*) as "# of Columns"
    FROM dba_tab_cols
    WHERE table_name = <table name>
    GROUP BY table_name
    ORDER BY table_name;There are other views as well such as USER_TAB_COLS and ALL_TAB_COLS.
    HTH!

  • Reducing number of columns in case query

    Hi all,
    I am operating on 10G R/2.
    I have a query which produces the columns with the number of counts.
    SUM (CASE WHEN LTRIM(RTRIM(W_O)) ='ROKOLBIN' THEN 1 ELSE 0 END) AS "O_ROKOLBIN",
    SUM (CASE WHEN LTRIM(RTRIM(W_I)) = 'ROKOLBIN'THEN 1 ELSE 0 END) AS "I_ROKOLBIN",
    sum(case when LTRIM(RTRIM(W_O)) ='GULURU' then 1 else 0 end) as "O_GULURU",
    sum(case when LTRIM(RTRIM(W_I)) ='GULURU' then 1 else 0 end) as "I_GULURU",
    sum(case when LTRIM(RTRIM(W_ON ))='PURE' then 1 else 0 end) as "O_PURE",
    I would like to reduce teh number of columns to 2,
    One column is for Division.Division can be either O_ROKOLBIN,I_ROKOLBIN,O_GULURU,I_GULURU,O_PURE
    The other column is Subtotal.Subtotal are teh sums as above ,SUM (CASE WHEN LTRIM(RTRIM(W_O)) ='ROKOLBIN' THEN 1 .
    Can anyone advie how can I acheiev this.
    Thanks.

    Hi,
    CrackerJack wrote:
    Hi all,
    Thank you for your wonderful ideas,
    I took it onboard and redesigned the query to add the dates.
    <pre>
    SELECT
    DATE_DIVISION week_start_date ,
    next_day ( DATE_DIVISION - 7, 'Sunday' ) + 6 week_end_date ,
    to_number(to_char(DATE_DIVISION,'WW') )week_no ,
    'I_'||W_I AS DIVISION ,
    COUNT(W_I) CNT
    FROM TEST A
    </pre>I get an error when I run that. Don't you need to say TEST_A, with an underscore?
    <pre>
    GROUP BY DATE_DIVISION, next_day ( DATE_DIVISION - 7, 'Sunday' ) + 6, to_number(to_char(DATE_DIVISION,'WW') ), 'I_'||W_I
    </pre>
    At the moment query is coming up like this:
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_GULURU     2
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_ROKOLBIN     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_ROKOLBIN     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1I don't think you're getting this output from the sample data you posted. The dates in the sample data are all in February. It would really help if you posted the actual data, and the results you want from that data. In this case, I suspect the whole problem is that the dates in your real data (unlike your sample data) all have different times. If that's so, use TRUNC (date_division), instead of date_division, like this:
    SELECT    TRUNC (date_division)     AS week_start_date
    ,       next_day ( TRUNC (date_division) - 1
                 , 'Saturday'
                    )           AS week_end_date
    ,       TO_CHAR ( date_division
                , 'FMWW'
                )          AS week_no
    ,       'I_' || w_i           AS division
    ,       COUNT (w_i)           AS cnt
    FROM        test_a
    GROUP BY  TRUNC (date_division)
    ,       TO_CHAR ( date_division
                , 'FMWW'
    ,       w_i
    ;

  • Count number of colums for that query.

    Hi all,
    I need to return the number of columns for that query, the columns are not known...dynamic columns.
    i.e
    1) Example 1
    select column1, column2
    from dual;
    Result should return counter = 2
    2) Example 2:
    select column1, column2,column3,column4, column5
    from dual;
    Result should return counter = 5
    from dual;
    Result should return counter = 2
    Thanks.

    qwestion wrote:
    I need to return the number of columns for that query, the columns are not known...dynamic columns.For this you'll need to use the DBMS_SQL package:
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE procedure query_col_count(p_sql IN VARCHAR2) IS
      2    c NUMBER;
      3    rec_tab DBMS_SQL.DESC_TAB;
      4    col_cnt INTEGER;
      5  BEGIN
      6    c := DBMS_SQL.OPEN_CURSOR;
      7    DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      8    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      9    DBMS_SQL.CLOSE_CURSOR(c);
    10    DBMS_OUTPUT.PUT_LINE('Number of columns: '||col_cnt);
    11* END;
    SQL> /
    Procedure created.
    SQL> exec query_col_count('select empno, ename from emp');
    Number of columns: 2
    PL/SQL procedure successfully completed.
    SQL> exec query_col_count('select * from emp');
    Number of columns: 8
    PL/SQL procedure successfully completed.
    SQL>

  • SQL Query - The number of columns specified in "SQL Query" does not match t

    I am creating new UDM for tablespace alert, below is my query,however its failing with error
    SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
    I selected Metric type is number
    SQL Query Format : Two columns
    Query:
    SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
    used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    Any clues why i am getting error.

    SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
    2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    TABLESPACE_NAME USED_PCT
    MGMT_TABLESPACE .82
    SYSAUX 1.52
    UNDOTBS1 .32
    RMAN .02
    CORRUPT_TS 10.63
    USERS 0
    SYSTEM 2.26
    MGMT_ECM_DEPOT_TS .04
    MGMT_AD4J_TS 0

  • RPD - Cannot obtain number of columns for the query result :Working with MS SQL 2012 schema

    Hi All,
    I have created my warehouse in MS SQL 2012.
    For management purpose, I have created different schemas in SQL database
    In RPD, Physical layer, when i view data > I get error as
    [nQSError:16002] Cannot obtain number of columns for the query result.
    [nQSError:16001] ODBC error state : S0002 code : 208 message: [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name 'tbl'..
    [nQSError:16001] ODBC error state : S0002 code : 208 message: [Microsoft][ODBC SQL Server Driver][SQL Server] Statements could not be prepared..
    I have already browsed : OBIEE 11g Strange ODBC Driver Error with SQL Server : Total Business Intelligence ... did not help me
    please help!!!

    Hi All,
    After all R&D it is been found that Oracle business administrator( RPD) needs default dbo schema. It doesn't accept custom schema for pulling data.
    If anybody have other views please share.!!
    Thank you

Maybe you are looking for

  • Stock Transfer process with message SPED

    Hi guys, I am trying to set up a stock transfer process, with a cross company purchase order that generates an outbound delivery which output message, SPED, generates the replenishment delivery through its internal process (standard program /SPE/STO_

  • Acrobat 7Pro - Reduce File Size

    I make PDFs by exporting from QuarkXPress 8, using the "Screen - Low/ Quality/Low Resolution" option for proofing. When I try to "Reduce File Size..." in Acrobat, it re-writes the files but DOESN'T make a smaller file. Any suggestions? I hate sending

  • I can't convert radio racording .aac file into .mp...

    Help me some one. When i record a radio file. It will be saved in .aac file. This .aac file aren't play in other device or computer. I want to convert into .mp3 file. Plz help me how to do this?

  • Embedded fonts & htmlText

    I'm trying to use embedded fonts in htmlText.  I've embedded the font in the Style tag:      @font-face {             src: url("someFont.ttf");             fontFamily: "myFont"; Now if I add it to a Text component like:      <mx:Text id="myText" html

  • Can I clone a TimesTen Database

    Is there a way that I could clone a TimesTen database copying all the commit and log files, in order to recover it in a different site?