Select at least 1 rank, even if the table is empty

Hi all

I've got table t1:
with t1 as (
select 1 as column1, 't' as column2 from dual
)
select * from t1 
My need is to select at least 1 rank, even if the table is empty, for example:
with t1 as (
select 1 as column1, 't' as column2 from dual
)
select * from t1 where rownum = 0
union all 
select 0 as column1, '' as column2 from dual
The problem is that I don't know the amount of columns and its data type. How can I make a dynamic query based on the current structure of table t1?

Hello

This looks like a job for an outer join:

SELECT  t1.*
FROM            dual
LEFT OUTER JOIN t1    ON  1 = 1
;

Because it is not reference individual columns from t1, you do not need to know what are the columns it, or what their data types.

Tags: Database

Similar Questions

  • I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    Mr President.

    I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    formdoubletables.png

    the page source is

    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                    xmlns:f="http://java.sun.com/jsf/core">
      <af:panelFormLayout id="pfl1">
        <af:group id="Group">
          <af:inputText value="#{bindings.VoucherId.inputValue}" label="#{bindings.VoucherId.hints.label}"
                        required="#{bindings.VoucherId.hints.mandatory}" columns="#{bindings.VoucherId.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId.hints.precision}"
                        shortDesc="#{bindings.VoucherId.hints.tooltip}" id="it1">
            <f:validator binding="#{bindings.VoucherId.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId.format}"/>
          </af:inputText>
          <af:inputDate value="#{bindings.VoucherDate.inputValue}" label="#{bindings.VoucherDate.hints.label}"
                        required="#{bindings.VoucherDate.hints.mandatory}"
                        columns="#{bindings.VoucherDate.hints.displayWidth}"
                        shortDesc="#{bindings.VoucherDate.hints.tooltip}" id="id1">
            <f:validator binding="#{bindings.VoucherDate.validator}"/>
            <af:convertDateTime pattern="#{bindings.VoucherDate.format}"/>
          </af:inputDate>
          <af:inputText value="#{bindings.Credit.inputValue}" label="#{bindings.Credit.hints.label}"
                        required="#{bindings.Credit.hints.mandatory}" columns="#{bindings.Credit.hints.displayWidth}"
                        maximumLength="#{bindings.Credit.hints.precision}" shortDesc="#{bindings.Credit.hints.tooltip}"
                        id="it2">
            <f:validator binding="#{bindings.Credit.validator}"/>
          </af:inputText>
        </af:group>
        <af:group id="g1">
          <af:inputText value="#{bindings.Lineitem.inputValue}" label="#{bindings.Lineitem.hints.label}"
                        required="#{bindings.Lineitem.hints.mandatory}" columns="#{bindings.Lineitem.hints.displayWidth}"
                        maximumLength="#{bindings.Lineitem.hints.precision}" shortDesc="#{bindings.Lineitem.hints.tooltip}"
                        id="it3">
            <f:validator binding="#{bindings.Lineitem.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Lineitem.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.VoucherId1.inputValue}" label="#{bindings.VoucherId1.hints.label}"
                        required="#{bindings.VoucherId1.hints.mandatory}"
                        columns="#{bindings.VoucherId1.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId1.hints.precision}"
                        shortDesc="#{bindings.VoucherId1.hints.tooltip}" id="it4">
            <f:validator binding="#{bindings.VoucherId1.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId1.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Debit.inputValue}" label="#{bindings.Debit.hints.label}"
                        required="#{bindings.Debit.hints.mandatory}" columns="#{bindings.Debit.hints.displayWidth}"
                        maximumLength="#{bindings.Debit.hints.precision}" shortDesc="#{bindings.Debit.hints.tooltip}"
                        id="it5">
            <f:validator binding="#{bindings.Debit.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Credit1.inputValue}" label="#{bindings.Credit1.hints.label}"
                        required="#{bindings.Credit1.hints.mandatory}" columns="#{bindings.Credit1.hints.displayWidth}"
                        maximumLength="#{bindings.Credit1.hints.precision}" shortDesc="#{bindings.Credit1.hints.tooltip}"
                        id="it6">
            <f:validator binding="#{bindings.Credit1.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Particulars.inputValue}" label="#{bindings.Particulars.hints.label}"
                        required="#{bindings.Particulars.hints.mandatory}"
                        columns="#{bindings.Particulars.hints.displayWidth}"
                        maximumLength="#{bindings.Particulars.hints.precision}"
                        shortDesc="#{bindings.Particulars.hints.tooltip}" id="it7">
            <f:validator binding="#{bindings.Particulars.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Amount.inputValue}" label="#{bindings.Amount.hints.label}"
                        required="#{bindings.Amount.hints.mandatory}" columns="#{bindings.Amount.hints.displayWidth}"
                        maximumLength="#{bindings.Amount.hints.precision}" shortDesc="#{bindings.Amount.hints.tooltip}"
                        id="it8">
            <f:validator binding="#{bindings.Amount.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Amount.format}"/>
          </af:inputText>
        </af:group>
        <f:facet name="footer">
          <af:button text="Submit" id="b1"/>
          <af:button actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"
                     disabled="#{!bindings.CreateInsert.enabled}" id="b2"/>     
          <af:button actionListener="#{bindings.Commit.execute}" text="Commit" disabled="#{!bindings.Commit.enabled}"
                     id="b3"/>
          <af:button actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}"
                     immediate="true" id="b4">
            <af:resetActionListener/>
          </af:button>
        </f:facet>
      </af:panelFormLayout>
    </ui:composition>
    
    
    
    

    Concerning

    Go to your VO Wizard, select the tab of the entity and to check if both the EO is editable or not.

    See you soon

    AJ

  • When I try to print PDF documents, I forst get a little screen that says that the document cannot be printed, then a small screenthat says no pages have been selected.  I can't even print the entire document.

    When I try to print two important documents, I first get a little screen that says that the document cannot be printed, then a second small screen that says no pages have been selected.

    Hi oldrealist,

    Try the following: open Adobe Reader | Change | Preferences

    • under Documents, change "Show the documents in PDF/A mode" Never.
    • under (enhanced) protection, clear the Safe_mode at startup.

    Let me know how it goes.

    Kind regards

    Nicos

  • Check if the table is empty

    Hey,.

    I want to make sure that if my MySQL table is empty users would receive "There is no information to display." in their browsers. Here's how I tried to do:

    If (! mysql_query ("SELECT * FROM Table", $con))
    {
    echo "< b > there is no information to display." "< /b > < br / > < br / > ';
    }
    on the other

    {

    echo "< b > we have something to show you. "< /b > < br / > < br / > ';

    }

    Although MySQL table is empty, it returns "We have something to show you." as if there are records in the DB table.

    Do I did wrong? Is there another way to check if the MySQL table is empty?

    * BTW - I use UniServer.

    See you soon,.

    DissidentPJ

    mysql_query only returns false in case of error. An empty recordset is not a mistake. Using a method of number of lines that you mentioned in your second post.

  • Rows in the table is empty when you import Excel

    Each month, I need to import Excel spreadsheets into an HTML page 'Nine', before you paste the part of the text in an existing page.

    Part of my procedure is to remove the outside (with data) lines on the worksheet prior to importation.  In design, the display, I import it seems to work and each resulting table has just the right number of lines. Then I do some find and replace, and copy the code I want in the existing page in Code view.

    When I change code mode, I find a lot of empty lines (with the same number of cells, such as active lines) in each set of active lines I pasted.  Because of the amount, withdrawal of these code view is time and frought with error (I could delete the active lines in the next game).  I think this artifact has started when I upgraded to CS5 in CS3.  Is there a way that I do not have these lines? If this isn't the case, could set the agenda so that the number of lines in code view corresponds to the number in design mode?

    Hello Terry,

    Without worker point I copy and paste about 23 rows of 8 columns of 5 different pages in Excel 5 different tables in DW5.5 every week.

    Honestly, it takes less than a minute for each is in a total view of 2.5 minutes.

  • index_join by the rowid of the table?

    Let's say you have a table like

    (t)

    int ID1,

    ID2 int,

    varchar (4000) textColumn1,.

    varchar (4000) textColumn2,.

    varchar (4000) textColumn3

    )

    And you have the index of individual columns on ID1 and ID2; composite index.  In my situation, I can't create an index composite (ID1, ID2).  But if I understand correctly, internally that both indices ID1 and ID2 are arranged as:

    Id1.1 rowid.3

    Id1.2 rowid.2

    Id1.3 rowid.4

    Id1.4 rowid.1

    Id2.1 rowid.1

    Id2.2 rowid.2

    Id2.3 rowid.3

    Id2.4 rowid.4

    So, if you did

    Select ID1 in t

    where ID2 > 2;

    A theoretically possible implementation plan would be to open the index the ID2 and ID1, find the ROWID for ID2, coincide with those against the ROWID in ID1, then pull the ID1 values directly from the index.  But any advice I launch in, (as index_join(), index(), opt_param ('_index_join_enabled', true) opt_param('optimizer_index_cost_adj',1), etc., he don't y no plan that never presented that does not open the table.)  And that's a problem because the table is actually quite massive and full of large columns.  So do a scatter read through the massive tablespace for this table is so much more expensive that just read the two indexes, even in their entirety.

    So is there a restriction that prevents pull the index values ID1, that has something to do with the insulation or missing/transaction null values or something?  Did I miss an optimization to make it work, or Oracle (11.2.0.4, I think) ever implementation of an index_join across two indexes to single column?

    It works for me in 12.1.0.2 if I do the column you want to select NOT NULL. This makes sense because otherwise the rowid would not appear in the index (although I don't see why that just cannot be interpreted as NULL). This also works if you filter nulls.

    SQL > create table t_1 (id1 number, id2 number, colonne_1 varchar2 (4000));

    Table created.

    SQL > create index t_1_idx_01 on t_1 (id1);

    The index is created.

    SQL > create index t_1_idx_02 on t_1 (id2);

    The index is created.

    SQL > explain the plan for
    2 Select / * + INDEX_JOIN (t t_1_idx_01) INDEX_JOIN (t_1_idx_02 t) * / id2 t_1 t where id1 =: X;

    He explained.

    SQL > @x

    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------
    Hash value of plan: 4181077581

    --------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    --------------------------------------------------------------------------------------------------
    |  0 | SELECT STATEMENT |            |    1.    26.    1 (0) | 00:00:01 |
    |  1.  TABLE ACCESS BY ROWID INDEX BATCH | T_1        |    1.    26.    1 (0) | 00:00:01 |
    |*  2 |  INDEX RANGE SCAN | T_1_IDX_01 |    1.      |    1 (0) | 00:00:01 |
    --------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    2 - access ('ID1' = TO_NUMBER (:X))

    Note
    -----
    -the dynamic statistics used: dynamic sampling (level = 2)

    18 selected lines.

    SQL > alter table t_1 change id2 not null;

    Modified table.

    SQL > explain the plan for
    2 Select / * + INDEX_JOIN (t t_1_idx_01) INDEX_JOIN (t_1_idx_02 t) * / id2 t_1 t where id1 =: X;

    He explained.

    SQL > @x

    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------
    Hash value of plan: 1085250311

    -------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -------------------------------------------------------------------------------------------
    |  0 | SELECT STATEMENT |                  |    1.    26.    2 (0) | 00:00:01 |
    |*  1 |  VIEW                  | the index $ _join$ _001.    1.    26.    2 (0) | 00:00:01 |
    |*  2 |  HASH JOIN |                  |      |      |            |          |
    |*  3 |    INDEX RANGE SCAN | T_1_IDX_01 |    1.    26.    1 (0) | 00:00:01 |
    |  4.    FULL RESTRICTED INDEX SCAN FAST | T_1_IDX_02 |    1.    26.    1 (0) | 00:00:01 |
    -------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 Filter ('ID1' = TO_NUMBER (:X))
    2 - access (ROWID = ROWID)
    3 - access ('ID1' = TO_NUMBER (:X))

    Note
    -----
    -the dynamic statistics used: dynamic sampling (level = 2)

    22 selected lines.

    SQL > alter table t_1 change id2 null;

    Modified table.

    SQL > explain the plan for
    2 Select / * + INDEX_JOIN (t t_1_idx_01) INDEX_JOIN (t_1_idx_02 t) * / id2 t_1 t where id1 =: X and id2 is not null;

    He explained.

    SQL > @x

    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------------------------------------------
    Hash value of plan: 1085250311

    -------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |                  |     1.    26.     2 (0) | 00:00:01 |
    |*  1 |  VIEW                  | the index $ _join$ _001.     1.    26.     2 (0) | 00:00:01 |
    |*  2 |   HASH JOIN |                  |       |       |            |          |
    |*  3 |    INDEX RANGE SCAN | T_1_IDX_01 |     1.    26.     1 (0) | 00:00:01 |
    |*  4 |    FULL RESTRICTED INDEX SCAN FAST | T_1_IDX_02 |     1.    26.     1 (0) | 00:00:01 |
    -------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 Filter ('ID1' = TO_NUMBER (:X))
    2 - access (ROWID = ROWID)
    3 - access ('ID1' = TO_NUMBER (:X))
    4 - filter ("ID2" IS NOT NULL)

    Note
    -----
    -the dynamic statistics used: dynamic sampling (level = 2)

    23 selected lines.

    Your columns of text are very large, what is your block size? Under the value by default 8 k blocks, if your lines are completely filled while they are chained, and readings by rowid will be additional i/o. Consider measures to avoid migration of line and row chaining. In my view, this could be the reason for your index access is so slow.

    Have a read of https://docs.oracle.com/database/121/TGDBA/pfgrf_instance_tune.htm#TGDBA024 10.2.4.3 Table Fetch by row continues to see the impact and ways to circumvent migrated/chained rows.

    If you select a large number of rows in the table the issue would become so what do you intend to do with so many? Is it possible that you could reduce the number of lines you choose?

  • error on the table.

    Hello people,

    I'm trying to retive archive data among my table but his table of view or view does not exist even if the table is in our scheme. and his daily exported in the export file. My table name is "tbltransactionlogarchivejul08" and the exported lines are.

    . . export the TBLTRANSACTIONLOG 1170202 exported table rows
    . . export the TBLTRANSACTIONLOGArchiveJul08 657486 exported table rows

    Waiting for the answer.

    Thank you

    Noman

    The table seems to be created by using double quotes.

    try to use

    select * from "TBLTRANSACTIONLOGArchiveJul08";
    
  • Help for the reconciliation of the table in a sequence

    I need assistance with the values of an array 1 d of channels read. Table 1 d of strings contains the names of the columns in a different table.

    This must be included in a file, but only once. IM is able to do, but the only problem, the table 1 d of strings contains the previously stored values.

    These values are from a list box, which is frozen as soon as the user clicks on the button OK/START in VI. I would like to print the values of frozen listbox, but it prints the values of the unfrozen ListBox instead.

    The problem is clear to me, I should create an empty array of strings and stores this value, but where in the order this is done?

    I have attached the VI, 'Header' is the table I'm talking about.

    Thank you

    Eureka

    Solved!

    I tried to complete the tables of empty strings in the header sub - VI writing and it works!

    Thank you

    Eureka

  • How to check the table (null / not null) on the screen?

    Hello all :)


    I am beginner in JDEV

    I have problem with table.
    When you view the table, I want to know if the existing data in the table are empty or not (check the query zero / non-zero)? How to do

    someone help me... :))

    THX
    agungdmt

    Hello

    If you use ADF BC, access the iterator and call getEstimatedRowCound

    Table richeTableau = get JSF component binding to table

    TableBinding JUCtrlHierBinding = (JUCtrlHierBinding) (table.getValue ()) .getWrappedData ((CollectionModel));
    DCIteratorBinding iter = tableBinding.getIteratorBinding ();

    int count = iter.getEstimatedRowCount ();

    You can do the same thing in EL

    #{bindings.iteratorName.estimatedRowCount > 0}--> true if given

    Frank

  • Until the latest update when the AutoComplete bar has been selected, he "went" no other by clicking. I must now click the refresh arrow. It won't work even with the return. How can I operate the old way easier?

    Until the latest update when the url I wanted in the address bar of AutoComplete has been selected, it "accompanies" no more further by clicking on. I must now click the refresh arrow. It won't work even with the return. How can I operate the old way easier?

    You can disable this extension in tools > Modules > Extensions and close and restart Firefox normally.

  • Windows 7 Media Player 12.0.7601: album art don't is not displayed even if the column is selected and album art is saved on the drive

    I just loaded all my music from my Windows XP system on my Windows 7 system.  Each album has album art that appears in "now playing".  But when I opened an album in library view and list titles, album art is not displayed even if she is among the columns selected to be shown.  All other columns appear and disappear depending on whether I choose them, but the album art is not.

    How to display album art?  Please don't tell me to switch to playback.  It is very unpleasant for me.  Even if the album art is displayed there, the space that is takes 2/3 of the screen to keep a small image of the cover of the album.  The list of receives securities only 1/3 remaining, so there is not enough space to display more than the name of the track, rating and length.  In addition, I don't want to see the sides, but they show that even though I have deselected this column.

    Windows 7 SP1 running Windows Media Player 12.0.7601.18741.

    HI - in the library WMP view did you check the setting on the box highlighted in yellow in the screenshot below? (Depending on which section you are in you need to 'extended tile' or 'icons')-R.

  • I can't get my calculations right away, even after the selection "commit selected value immediately" on my drop-down menus. Any ideas?

    I can't get my calculations right away, even after the selection "commit selected value immediately" on my drop-down menus. Any ideas?

    The field calculation order is probably not set correctly. The specific configuration procedure it depends on which version of Acrobat you are using. Acrobat 11, you would go first in forms editing mode (Tools > forms > change), and then select:

    Tasks > other tasks > set field calculation order

  • How to validate at least one line selected on the table?

    Hello world

    I have a requirement here to display a list of customers at a table "select unique" and a button to send the page. When the user clicks this button, I need to validate if there is a selected line in the table. What is the best approach tho do?
    I tried to validate it on actionListener in the click of a button, but even if I put adfFaces messages running, it does not appear on the screen and the page is still subject.

    Is the BPM 11 g context of the project, so I have to do this validation and 'Cancel' the submit, otherwise the data passes through the flow until the next activity.

    Maybe the real question is: how to undo a page submit during an actionListener?

    Thank you

    Hello

    Small correction to Vinod, tableBinidng.getSeelctedRowKeys () always returns non-null (returns empty set when nothing is selected), then use the tableBinidng.getSeelctedRowKeys () .getSize () to check if a line is selected or not (0-nothing selected).

    If you do not want to treat the action up to save if an option is selected, why don't you try disable the button until something is selected in the table?

    To disable a button when no rows selected, simply add after the disabled property of a button value update it based on the table (add partialTriggers to the table)

    
    
    

    Jean Lou

  • Exports of MPEG2-DVD MUCH too fast and creates an excerpt of quality even if the preview mode not selected

    This is a repost with a new title, by the suggestion of Bill.

    I had a 30-minute PP CS4 project with tons of graphics (rendering models AE movies H.264, film background, psd, etc), 720 p 60 overall images, music and sfx. He looked closely like the last 30 minute DVD, I did, but with more graphic things. The sequence is HDV 720 p 30

    The last export MPEG2-DVD lasted 17 hours (my system is displayed in my profile). It took only two hours. The only difference I can think is that this time that I made the whole preview timeline while the last time I did not. The SOUL export parameters were identical, including by selecting 'quality to make Maximum usage. The results of the last time were good. The result this time is not - it looks like a quality excerpt.

    In the original original post here, Bob Peru reports the same unusual experience. He said:

    I have experienced the same improvement in time export via the rendering of the chronology, even if I know positively that "use the preview files" is unchecked.

    I wonder if there is some sort of bug where it says that it does not use the preview files, but it is in fact.

    I hope someone knows what is happening here. My project is weeks late and loans from, except for this problem.

    Maybe delete all files preview?

    Thank you, everyone.

    If you are sure that you do not preview for this project files, so the only other explanation for the lag is that this project was simply not as complex of export like the others (assuming that there were no hardware upgrades between projects).

    In other words, there are only a few things that can affect the export time.  They are:

    1. support of source.

    2 export settings.

    3. the complexity of the project.

    4. material capabilities.

    5. use of the preview files.

    6. software version.

    If 1 and 2 are the same for both projects, and assuming that the 4, 5 and 6, has not changed, then the cause of faster exports must be 3.

  • Drag the tables, odd and even rank-background color?

    How can I set the background color of line of odd and even rows? in adf dragged table

    line 1-white

    line 2-black

    line 3-white

    line 4-black

    Always mention jdev version.

    See this post: line alternative color in the table of the ADF

    Dario

Maybe you are looking for