Script or query to generate a report of null or not null columns

I need a script/query it should pick up all the tables from user_tab_columns and produce a report for all the tables which are the columns are null and not null.

As long as the columns were defined as NOT NULL on table create, or ALTERed NOT NULL, you can do this:
SQL> CREATE TABLE t (id NUMBER NOT NULL, descr VARCHAR2(10));
Table created.
SQL> SELECT column_name, table_name, nullable
  2  FROM user_tab_columns
  3  WHERE table_name = 'T';
COLUMN_NAME                    TABLE_NAME                     N
ID                             T                              N
DESCR                          T                              Y
SQL> ALTER TABLE t modify (descr NOT NULL);
Table altered.
SQL> SELECT column_name, table_name, nullable
  2  FROM user_tab_columns
  3  WHERE table_name = 'T';
COLUMN_NAME                    TABLE_NAME                     N
ID                             T                              N
DESCR                          T                              NNote that if you do:
ALTER TABLE t ADD CONSTRAINT id_nn CHECK (id IS NOT NULL);then the nullable column in xxx_tab_columns will remain as Y.
HTH
John

Similar Messages

  • Cannot build the query or generate the report. WIS 30351

    I am trying to create a docuemtn using SDK. I have created a document and when I try to add dataprovider and update the document, I am facing the below error
    Cannot build the query or generate the report. WIS 30351
    http://help.sap.com/saphelpiis_sbo41sp5wi-sdk/frameset.htm?ec5645bc6fdb101497906a7cb0e91070.html
    Any help would be appreciated...

    Hi Pirabu,
    here's the required steps for what you described:
    1. Create a new report in folder with ID 12345:
         POST ../raylight/v1/documents
         request body:
            <document>
            <name>My New Doc</name>
            <folderId>12345</folderId>
            </document>
          response:
            <success>
            <message>The resource of type "Document" with identifier "54321" has been successfully created.</message>
            <id>54321</id>
            </success>
    2. use the new document ID when adding a data provider (ie universe ID is 5543)
          POST ../raylight/v1/documents/54321/dataproviders
          request body:
            <dataprovider>
            <name>Query 1</name>
            <dataSourceId>5543</dataSourceId>
            </dataprovider>
          response:
            <success>
            <message>The resource of type "Data provider" with identifier "DP0" has been successfully created.</message>
            <id>DP0</id>
            </success>
    If you are doing something different, please provide the steps you are using and the type of datasource you are adding (unv, unx, Bex query etc).
    Is the error when adding the data provider, or do you have an additional step updating the document?
    Also, what version of BI4 are you working with?
    Dan

  • Cannot build the query or generate the report - BI4.0 Dashboard on WebService Error

    Hello All,
         I am trying to create a Dashboard with WebService connections in SAP BI4.0 SP04. While running the dashboard I am receiving the error, Cannot build the query or generate the report. I have already set the refresh parameter to TRUE (bound to an excel cell and I have tried with 1 also). Back end WebI Reports of the BIWS connections are created from BEx queries through BICS connection. I have two prompts to run the Web Service and the report. Please share your thoughts regarding this.
    Thanks and Regards,
      Debajyoti Dan

    Hi All,
        I have found the issue. The problem is coming only when I am receiving prompts from BEx query and trying to use them through dashboard. I replaced these BEx prompts with the same in WebI report. Then the entire functionality started working correctly from dashboard.
    But, this is only a work around and can not be applied at all times. So I have raised a message for the same to SAP. I will update the thread based on what I receive from SAP Support.

  • Query to generate a report for incoming pending payments as per Item Group!

    Dear All,
    I need a Query to generate a report for incoming pending payments through Item Group.
    Please provide me the same.
    Thanks in advance..........................
    Edited by: Param Deshwal on Nov 22, 2011 7:11 AM

    Hi
         try this
    SELECT T0.[DocNum] as 'Invoice Number', T0.[DocDate] as 'Invoice Date', T0.[CardName], T0.[DocTotal] as 'Invoice Amount', T0.[PaidToDate] as 'Paid Amount',(T0.[DocTotal]-T0.[PaidToDate]) as 'Pending Amount',T3.[ItmsGrpnam] FROM OINV T0 Inner join inv1 t1 on t0.docentry=t1.docentry inner join oitm t2 on t2.itemcode=t1.itemcode inner join oitb t3 on t3.[ItmsGrpcod]=t2.[ItmsGrpcod] where T3.[ItmsGrpnam]=[%0] 
    Regards,
    sudhir B.
    Edited by: B.sudhir on Nov 22, 2011 7:28 AM

  • Query to generate a report

    Hi All,
    I am trying to query the following table to generate a report
    SQL> select * from sample_tab;
    ID ITEM_CODE STATUS
    smtabid01 book placed
    smtabid01 book billed
    smtabid01 book shipped
    smtabid02 Magazine placed
    smtabid02 Magazine billed
    smtabid03 stationary placed
    smtabid04 Folders placed
    smtabid04 Folders shipped
    8 rows selected.
    Report should be as follows
    ID ITEM_CODE PLACED BILLED SHIPPED
    smtabid01 book Success Success Success
    smtabid02 Magazine Success Success Pending
    smtabid03 stationary Success Pending Pending
    smtabid04 Folders Success Pending Success
    Basically I am trying to group the status of all the id's into single row
    I have tried the following query, but this gives the output for each row. I know this is not the correct query but I couldnt figure out how to accomplish this
    select id,item_code,decode(status,'PLACED','Success','Pending'),decode(status,'BILLED','Success','Pending'),decode(status,'SHIPPED','Success','Pending')
    from sample_tab;
    Can anybody please help!!
    Thank you!!

    Hi,
    You're on the right track!
    The query you posted is producing multiple rows for each id: you want one row per id. That sounds like a job for "GROUP BY id".
    This does what you want:
    SELECT     id,     item_code
    ,     NVL (MAX (DECODE (status, 'placed',  'Success')), 'Pending')     AS placed
    ,     NVL (MAX (DECODE (status, 'billed',  'Success')), 'Pending')     AS billed
    ,     NVL (MAX (DECODE (status, 'shipped', 'Success')), 'Pending')     AS shipped
    FROM     sample_tab
    GROUP BY     id,     item_code
    ORDER BY     id,     item_code;

  • Interactive Report with Null Columns

    I've got a user who wants to export an interactive report, and he needs certain columns to appear on the export for him to fill the data in later (this is an intermediate step, while we work on getting all the data he needs in to the database). I've created the report query, and there are a handful of null/empty columns (to preserve the correct order for the export). When I try to add this query to APEX in an interactive report, I get a "ORA-00001: unique constraint (APEX_040000.WWV_FLOW_WORKSHEET_COLUMNS_UK2) violated" error.
    Googling around shows me that this happens because of similarly-named columns, and the solution is to provide aliases to all columns. My report has aliases on all columns, but I still cannot create an interactive report. I've tried changing the null columns to empty strings, as well as enclosing the aliases in double-quotes, but nothing works. I can however use my original query to create a standard report, but due to the export requirement, this isn't ideal.
    I was able to create the interactive report with one null column, and then edited the report source to add in the others. This had to be done one at a time, since trying to add multiple null columns at the same time gives the same error again. Unfortunately, when I try and run the page, I get an "ORA-20001: get_dbms_sql_cursor error ORA-00918: column ambiguously defined" error.
    My original query:
    select customer.customer_name as customer,
           project.name as project_name,       
           trunc(project.estimated_end_dt) as due_date,
           project_status.project_status_desc as status,
           null as revenue,
           project.baseline_effort as baseline_hours,
           null as projected_cost,
           null as est_gain_loss,
           project.actual_hours as actual_hours,
           project.estimated_hours as projected_hours,
           null as projected_cost,
           null as projected_gain_loss,
           null as roi      
        from project,
             customer
      where customer.customer_id = project.customer_id
      and project.inactive_ind = 0
      and project.customer_id is not null
      and project.estimated_end_dt >= :DTP_P50_STARTDT
      and project.estimated_end_dt <= :DTP_P50_ENDDT
    order by customer.customer_name,
             project.estimated_end_dt;             Can someone tell me a way to create an interactive report with multiple null columns?

    Hi shimmoril,
    The problem is likely that you have two columns aliased as "projected_cost" (7th column and 11th column).
    Hope this helps,
    John
    If you find this information useful, please mark the post "helpful" or "correct" so that others may benefit as well.*

  • What will be the query to generate this reports ?

    Dear Exparts,
    Here is my banner
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    "CORE     10.2.0.3.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - ProductionHere is the sample data
    TId     TDate               TName     TCol1     TCol2     TCol3     TCol4     TCol55     TCol56     TCol N
    1     01-aug-2012     Abc     Ab     Bc     aa     bb               TT
    2     05-aug-2012     abc     A     A     aa     bb               TT
    3     20-aug-2012     bcd     AA     AA     BB     bb     C     D     TTI want to produce the following report
    Revision Date     Revision Field     Previous Value     Revised Value
    05-aug-2012     TCol1                Ab                  A
                    TCol2                Bc                  A
    20-aug-2012     TName                      Abc           Bcd
                    TCol1                A                   AA
                    TCol2                A                   AA
                    TCol3                Aa                  BB
                    TCol55                                   C
                    TCol56                                DHow can i do this... ?
    Here is the script for create table
    CREATE TABLE TB_TEST
      TID NUMBER(5)
    , TDATE DATE
    , TNAME VARCHAR2(20)
    , TCOL1 VARCHAR2(20)
    , TCOL2 VARCHAR2(20)
    , TCOL3 VARCHAR2(20)
    , TCOL4 VARCHAR2(20)
    , TCOL55 VARCHAR2(20)
    , TCOL56 VARCHAR2(20)
    , TCOLN VARCHAR2(20)
    );Script for sample data
    INSERT INTO TB_TEST (TID,TDATE,TNAME,TCOL1,TCOL2,TCOL3,TCOL4,TCOLN)
    VALUES (1,TO_DATE('01-AUG-2012','DD-MON-RRRR'),'ABC','AB','BC','AA','BB','TT');
    INSERT INTO TB_TEST (TID,TDATE,TNAME,TCOL1,TCOL2,TCOL3,TCOL4,TCOLN)
    VALUES (2,TO_DATE('05-AUG-2012','DD-MON-RRRR'),'ABC','A','A','AA','BB','TT');
    INSERT INTO TB_TEST (TID,TDATE,TNAME,TCOL1,TCOL2,TCOL3,TCOL4,TCOL55,TCOL56,TCOLN)
    VALUES (3,TO_DATE('20-AUG-2012','DD-MON-RRRR'),'BCD','AA','AA','BB','BB','C','D','TT');Thanks..
    Edited by: Asked to Learn on Sep 9, 2012 6:57 PM

    Hi,
    Asked to Learn wrote:
    Dear Exparts,
    Here is my banner ...Thanks; that's helpful.
    Here is the sample data
    Id     Date               Name     Col1     Col2     Col3     Col4     Col55     Col56     Col N
    1     01-aug-2012     Abc     Ab     Bc     aa     bb               TT
    2     05-aug-2012     abc     A     A     aa     bb               TT
    3     20-aug-2012     bcd     AA     AA     BB     bb     C     D     TT
    That's not so helpful. Whenever you have a question, post CREATE TABLE and INSERT statements for the sample data. See {message:id=9360002}
    I want to produce the following report
    Revision Date     Revision Field     Previous Value     Revised Value
    05-aug-2012     Col1                Ab                  A
    Col2                Bc                  A
    20-aug-2012     Name              Abc                Bcd
    Col1                A                   AA
    Col2                A                   AA
    Col3                Aa                  BB
    Col55                              C
    Col56                                DHow can i do this... ?First, Unpivot the data so that, instead on having 8 columns of comparison data on 1 row, you have 1 column on 8 rows. Since you're using Oracle 10.2, you can't use the SELECT ... UNPIVOT feature, but there are other ways to unpivot. See {message:id=10562807} for a technique that works in Oracle 9.1 or higher.
    Then, use the anlytic LAG function to compare each vlaue to its previous value. You can do the same sort of thing with the revision_date column, to display NULL when it's the same as the previous row.
    If you'd like help, post CREATE TABLE and INSERT statmements for the sample data, and your best attempt. Simplify the problem at first. Just unpivot name and col1: forget about col2 through coln for now. Once you have a solution for 2 columns, modifying it for 8 (or 9, or 89) columns will be easy. When you can unpivot the 2 columns, see if you can use LAG to compare them.

  • Error when generating the report in Production Server

    Hi,
    I have created one infoset query in Development server of my client. It is working fine there. I had transported the request containg this query to Production server. But whenever I am trying to generate report using this query in Production server it is giving an error message
    "Error when generating the report".
    I am not getting what 's problem.
    Samriddhi

    Samriddhi,
    Genarally its not suggested to transport Queries. Should be able to create Queries directly Production. There might be diferences between your Development and Production versions.
    Thanks.

  • How to make the generated xl reporter un editable

    Dear Experts
    One of my client is asking , they want to generate the report in xl reporter (all kinds of report) but the end user must not edit that report. He just need only read only facility.
    So how to generate a read only report in xl reporter
    I need some help regarding this
    Thanks
    Regards
    Kasi

    Dear Experts.
    If i am giving a password for the Xl reporter, I am unable to generate the xl reporter, its showing error.
    and instead of the password security, if i protect the sheet, its working, but the problem is, end user can unprotect the sheet and able to edit the report.
    My scenario is. I want the end user to generate the report, but he should not be in a position to edit the generated report.
    Expect the help for solving this issue

  • FIFO Query to generate report Which relates the out-quantity to in-quantity

    Dear Experts,
    I am trying to generate a report to find out the Inward documents of Items which are issued or transfered. Items are managed with FIFO. Certain Items are serially managed and certain not.
    I am using the tables OIVL, OIVE and OIVQ for getting the details.
    Now my problem is in certain situations the relation between OIVE and OIVQ returns more line items than required and not able to specifically found out the rows. (Same TreeID is used for several transactions)
    Please help
    Thanks and regards
    Ajith Gopalakrishnan

    Hi,
    This Query help you a lot as I made this query for displaying the recieve and out quantity of an item as per the date i.e. On which date you recieve how much quantity of an item and how much quantity you release of an item. and please amend the remaining transtype from the transaction table (OINM).
    In case of FIFO you know that First IN First OUT is followed so you can easily see that which item on a particular date you recieve and which item on a particular date you release...and if any more further enhancement you required then please let me know ....if will definitely make out some time to help you out.
    select distinct SUM(InQty)as InQty,SUM(OutQty)as OutQty,ItemCode,Dscription,DocDate, TransType,
    case TransType
    when '-2' then 'opening Balance'
    when '20' then 'Goods Reciept PO '
    when '59' then 'Reciept From Production/Good Reciept '
    when '15' then 'Deliveries '
    end as 'TransName'
    from (
    select ItemCode,Dscription,DocDate, InQty,OutQty,TransType from oinm ) as OINM
    group by DocDate,ItemCode,TransType,Dscription order by  docdate asc
    Thanks
    Randy

  • Generating Dynamic Query for Ad-Hoc Reports

    Hello,
    What is the best way to create a dynamic query to generate ad-hoc reports? I have a couple of ideas but not sure which would work best and be most flexible.
    I would like our users to be able to check checkboxes for what data they would like returned in their report. The data would be pulled from a number of tables, 10+, depending on what pieces of data they checked.
    Should I write one dynamic query, with a bunch of IF statements in it?
    Should I write many individual queries and then join them together in a temp query?
    Should I create a temp table on our SQL server which contains the data from all of the tables; then query that? (I am worried about data being out-of-date with this option.)
    Which one of these solutions should I go with or is there a better solution that I am not considering?
    Thanks for the help.
    Josh

    Do you mean a Stored Procedure? Would the Stored Procedure then have one query on it with a bunch if IF statements? Maybe a bad example, but something like this?
    Yep.
    I haven't written a proc for a coupla years (I have DB people to do that for me now, bless 'em), but every DB is different, so the approach will vary depending on what DB you have.  It's perhaps time to buy a book or do a google or something.
    Adam

  • Programmatically change the query used to generate Oracle Reports

    I have two queries. Depending on some parameter value, I would like to use one of these queries to generate my report. Is it possible to programmatically change the SQL query used to generate the Oracle Report.
    Thanks

    There are two options:
    - The easy way
    In the report paper layout create two frames, one for each query , and at runtime
    display only one based on your parameters. (using format triggers on the frames)
    - the not so easy way (but more elegant)
    create the query at runtime using xml customizations using the examples from
    the following documentation:
    http://download-
    uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_xml.htm#i1006734
    16.3 Creating XML Data Models
    16.4.1.3 Applying an XML Report Definition in PL/SQL
    16.4.1.3.2 Applying an XML Definition Stored in Memory
    Regards and Good Luck
    Ionut S

  • SQL Query involved to Generate the reports

    Hi,
    I have created Vendor report which internally refers two tables from the vendor and store table (Both the tables are not directly Joined each other)
    i want to see the SQL Query involved to generate the report.
    where can i see that?
    Regards,
    Prasanthi

    in nqquery.log file:
    10g -> $BI_ORACLE_HOME/server/Log
    11g -> $ORACLE_INSTANCE/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1

  • Enable SQL Query logging while generating a report

    I am a newbie to BI Publisher. We are using Oracle BI Publisher 11.1.1.5.0 for reports generation.
    I am trying to get the actual SQL query executed when a report is generated.
    It would be great if any one can share some tips to enable SQL query logging and how to verify it.
    Thanks,
    Satya

    Thanks for your response.
    It seems the NQQuery.log is for OBIEE not for BI Publisher. I could see the admin guide refers to Oracle Fusion Middleware System Administrator's Guide for Oracle Business Intelligence Enterprise Edition.
    I raised an SR at myoraclesupport (MOS), I got a response saying enable SQL query log option is not available in BIP.
    Best regards,
    Satya

  • Generating hourly report from oracle database using sql developer .Help

    I am working on SQL Developer 1.5.1, i need to prepare hourly record of the activity on the database, for that i have a sql query that gives me the report as per selected columns on hourly basis.I need to prepare 24 reports a day.
    Each time i have to go to the query , change the date as per hours like form 22:06:2011 10:00:00 to 22:06:2011 11:00:00 and get the report and export it in excel.
    I want to automate the script so that whenever i run the script , it just asks me the date and runs the script 24 times and fetch me the hourly report of whole day.
    the query syntax is something like this
    Select
    from
    where
    And.......................
    And...................
    And......................
    And req date between to-date( 22:06:2011 10:00:00) And to-date(22:06:2011 11:00:00)
    Order by 7,1,2,3,4,5
    Is there any possibility that i can automate the script to automatically change the hour itself and generate a report in excel 24 times?please share if you have any idea on this.
    Looking forward for a response.

    This gives you data for the whole day and the first column tells you which hour data it is,
    SELECT 'HOUR' || TO_CHAR ( req_date, 'HH24') AS hour_num,
           col1,
           col2,
           col3
      FROM table_name
    WHERE TRUNC (req_date) = TO_DATE ( '22/06/2011', 'DD/MM/YYYY')G.

Maybe you are looking for

  • How to use old phone on another line after upgrade?

    Let's say that I've 2 lines, one with iPhone 4 and another with iPhone 5. If I upgrade the iPhone 5 to iPhone 6, how can I replace the iPhone 4 on the other line with the now extra iPhone 5?

  • Problem in BDC

    Hii all, I have develop a BDC for transaction pa30( for 2013  infotype ). DATA: MODE1 TYPE C VALUE 'N',         UPDT1 TYPE C VALUE 'A'. CALL TRANSACTION 'PA30'  USING  BDCDATA                              MODE   MODE1                              UPD

  • 10.4.6 Has killed my machine TWICE

    Twice I have tried to install 10.4.6 on my 533 MHz G4 and both times I have been locked in never ending start up. In fact, the first time I tried to install this update I think it somehow killed my system drive. I have since switched to a new hard dr

  • Radeon 6490M stalling MBP on internal display, running fine on ext. monitor

    Hi, my early 2011 MBP (2,0 Ghz i7 - running OSX 10.8.2) started acting strangly a few days ago. When I use the internal display at home, the machine will crash whenever tasks are handed over from the Intel HD G 3000 to the Radeon 6490. However, when

  • Flat Frequency Response

    I probably shouldn't have to be asking this question since I charge people for my obviously amateurish recording abilities but it's one that I've never had explained to me and one I need to know the answer to...... Let me set the question up this way