Returns all the values in the table

Hi team
I want a query please help
I have a table emp in that we ename, empno, sal comm

as

Select ename, empno, EMP comm
where comm = 300

It will run 300 records

If I don't give any number of comm as null
so I want to run the date all the
I user nvl

as

Select ename, empno, EMP comm
where comm = nvl (& comm, comm);

output: bad.

Yes, it's the query I use also and is to return all the lines

SQL > select * from emp where nvl (to_char (comm), '0') = nvl (to_char(&comm), nvl(comm,'0'));
Enter the value of comm: "
old 1: select * from emp where nvl (to_char (comm), '0') = nvl (to_char(&comm), nvl(comm,'0'))
new 1: select * from emp where nvl (to_char (comm), '0') = nvl (to_char (""), nvl(comm,'0'))

EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH COMMITTED 7902 17 DECEMBER 20 800 80
7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
7566 JONES MANAGER 7839 2975 2 APRIL 81 20
7654 MARTIN 7698 28 - SEP - 81 1250 1400 30 SALESMAN
7698 BLAKE MANAGER 7839 2850 MAY 1, 81 30
7782 CLARK MANAGER 7839 2450 JUNE 9 81 10
7788 SCOTT ANALYST 7566 3000 APRIL 19, 87 20
PRESIDENT OF 7839 17 NOVEMBER KING 81 5000 10
7844 TURNER 7698 08 - SEP - 81 1500 0 30 SALESMAN
7876 ADAMS 7788 1100 23 MAY CLERK 87 20

EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7900 7698 DECEMBER 3, CLERK JAMES 81 950 30
7902 7566 3000 3 DECEMBER ANALYST FORD 81 20
7934 MILLER COMMITTED JANUARY 7782 1300 23 82 10

14 selected lines.

Kind regards
Navneet

Tags: Database

Similar Questions

  • How to filter data according to internal application and in case if returns nothing outside the query must return all the lines

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    Select * AB

    where b in (select b BC where b = "2sample")

    This query will return me 1 row, but there are cases where the value of the parameter b is null

    and that it should return all rows in the table

    as

    Select * AB

    where b in (select b BC where b = "2sample")

    which return specific values, but I want to change in a way when the inner query returns nothing then outer query should return all the lines and works as

    Select * AB;

    Is it possible to put in a single query

    Hello

    You seem to ask for different things.  You want all the lines AB when

    1. The parameter ("2sample' in the example) is NULL, or when
    2. There is no corresponding row in the 2 tables (which could happen even if the parameter is not NULL)

    ?

    Assuming you want the option 2, here's one way:

    WITH got_rnk AS

    (

    SELECT ab.*

    DENSE_RANK () (ORDER IN CASE

    WHEN b (IN)

    SELECT b

    BC.

    WHERE b = "2sample" - parameter

    )

    THEN "A".

    OF ANOTHER 'B '.

    END

    ) AS rnk

    AB

    )

    SELECT a, b

    OF got_rnk

    WHERE rnk = 1

    ;

    This does not assume b is unique in each table.

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

  • How can I get the script all the tables and the reference system?

    Hello

    I'm trying to get the scripts of all the tables in my exquema MADE. Please can someone help me?

    Try this - the first script creates a 'tab_ddls' table to hold the table DDLS and second script generates the DDL and stores in this "table"tab_ddls ":

    {code}
    create the table tab_ddls (table_name, varchar2 (50))
    table_ddl clob)
    /

    declare
    cursor tab_cur is
    Select table_name
    from all_tables
    where owner = "MADE";
    CLOB table_ddl;
    Start
    for rec in tab_cur
    loop
    Select dbms_metadata.get_ddl ('TABLE', rec.table_name, 'MADE')
    in table_ddl
    Double;
    insert into tab_ddls (rec.table_name, table_ddl) values;
    end loop;
    dbms_output.put_line ('done');
    commit;
    end;
    /

    Select * from tab_ddls
    /

    {code}

    Please modify the script to fit your needs.

    HTH

    Published by: user130038 on August 2, 2011 11:08

  • Get all the tables on a page

    I need to get all of the tables on a particular page. The document consists of a bunch of unrelated text blocks. I use this to retrieve the tables:

    var doc = app.activeDocument;
    page var doc.pages = [54];

    var tables = page.textFrames.everyItem ().tables.everyItem () .getElements ();
    Alert (tables. Length);

    This page (page 55) has 3 tables on it, but my code returns only 2 tables. A table can be placed directly on a page and not be in a block of text? If Yes, what is the best way to get all the tables in a page? Thank you very much.

    Rick Quatro

    Ah, I don't know who. "Tables" is a collection, not a simple table and a reckless experimentation of shows that you can't simply use .concat glue them together.

    I'm sure I've seen a couple of workarounds for a situation like this. Maybe it's time to read "[CS3] [JS] everyItem() and getElements()"-i.e. of Marc Autret posts on this subject, at the end of this thread.

    In other words, if you stick to use everyItem()! It is perhaps easier to build a table "the old-fashioned way". Copy the following code is based on my earlier assumption you officials texts bound in management of related texts, but you can rewrite it to accommodate groups, thus:

    t = app.layoutWindows[0].activePage.textFrames.everyItem().tables;
    tableList = [];
    for (i=0; i		   
  • To get all the Table names

    Hi all

    I have almost 70 procedures in my database.
    I want to get all the names of the different tables used in the procedures of 70.
    Is this possible?

    Note:
    All the table names are prefixed by the name of schema as DEVSRC.table_name.


    Please advice

    Thank you
    JO

    Johney says:
    Hi, VT

    A doubt.

    This query will give the names of the tables to only select stmt used in the procedure

    or

    List of table names that accompany in all DML operations inside the procedure?

    Thank you
    JO

    It will give all the table to be used in select or any DML...

    You can also view by creating a temp proc

    SQL> drop procedure proc_test;
    
    Procedure dropped.
    
    SQL> select name, referenced_name, dependency_type from user_dependencies
      2  where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST';
    
    no rows selected
    
    SQL> create or replace
      2  PROCEDURE proc_test
      3  IS
      4  v_ID    number;
      5  v_PRID  number;
      6  v_PRLID number;
      7  v_DATERECEIVED date;
      8  Cursor C1 is
      9  select * from table_c;
     10   BEGIN
     11   open c1;
     12     LOOP
     13      FETCH c1 INTO v_ID,v_PRID,v_PRLID,v_DATERECEIVED;
     14      EXIT WHEN c1%NOTFOUND;
     15      insert into table_b values(v_ID,v_PRID,v_PRLID,v_DATERECEIVED);
     16      Commit;
     17     END LOOP;
     18   CLOSE C1;
     19   END;
     20  /
    
    Procedure created.
    
    SQL> select name, referenced_name, dependency_type from user_dependencies
      2  where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST';
    
    NAME
    ------------------------------
    REFERENCED_NAME                                                  DEPE
    ---------------------------------------------------------------- ----
    PROC_TEST
    TABLE_B                                                          HARD
    
    PROC_TEST
    TABLE_C                                                          HARD
    
    SQL> 
    

    Concerning

    Umesh

  • How do to know all the tables on peoplesoft (on Oracle 8.1) with data

    I need to know all the tables on peoplesoft (on Oracle 8.1) < strong > with < facilities > data
    and ignore the tables without data.

    It takes to write a pl/sql procedure or is there an easy solution?
    I wrote an example of code, but I am disconnected programming
    for the long and I need help.
    Thanks in advance
    Pls answer
    _______________
    Cursosr curtab is select table_name from dba_tables;
    curtab() loop
    Select count (*) x from curtab;
    If x & gt; 0
    UTL_FILE. Write ('curtab')
    on the other
    null;
    endif;
    end loop;
    ____________________

    Julia wrote:
    I need to know all the tables on peoplesoft (on Oracle 8.1) with data
    > & ignore tables without data.
    >
    > It takes to write a pl/sql procedure or is there an easy solution?
    > I wrote a code example, but I am disconnected programming
    > for a long time and I need help.
    > Thanks in advance
    > Pls answer
    > _______________
    > Cursosr curtab is select table_name from dba_tables;
    > curtab() loop
    > select count (*) x from curtab;
    > If x > 0
    > utl_file.write ('curtab')
    > other
    > null;
    > endif;
    > end of loop;
    > ____________________

    Consider using the user_tables and it works the relevant schema rather than dba_tables breast or of all_tables as these allows you to specify the schema name too will require.

    set serveroutput on;
    
    DECLARE
      cursor curtab is
        select table_name
        from   user_tables;
      --from   all_tables where owner = '';
      v_cnt NUMBER;
    BEGIN
      FOR t IN curtab
      LOOP
        EXECUTE IMMEDIATE 'select count(*) from '||t.table_name INTO v_cnt;
        IF v_cnt > 0 THEN
          DBMS_OUTPUT.PUT_LINE(t.table_name);
        END IF;
      END LOOP;
    END;
    /
    

    Or...

    Ensure that statistics were collected for the schema and examine the value of num_rows in the user_tables view. ;)

  • Dear Apple, I am Sayed of Egypt living in Saudi Arabia and I am a user of the I produced phone since I phone 4 and really I'm shocked by the incident that happened to my phone I 6 when he returned on the table which has led to the breakdown of screen whic

    Dear Apple, I am Sayed of Egypt living in Saudi Arabia and I am a user of the I produced phone since I phone 4 and really I'm shocked by the incident that happened to my phone I 6 #F2NNQ1WZG5QW when he returned on the table which has led to the breakdown of screen which is quite weird for me and not accepted for the kind of quality of apple products , I went to the Agency here for the interview they asked me to contact you directly. I'm waiting for your answer to fix my screen. Thankx Sayed

    You don't talk to Apple. This is a user forum.

    Accidental damage are not covered by the warranty.

  • How can I use statistics for all the tables in a schema in SQL Developer? and how long will it take on average?

    Hello

    How can I use statistics for all the tables in a schema in SQL Developer? and how long will it take on average?

    Thank you

    Jay.

    Select the connection and right-click on it and select schema statistics collection

  • How to find all the table names in all modules in EBS R12?

    How to find all the table names of all the modules in EBS R12?

    In addition, you can go to http://etrm.oracle.com, you select the version of the EBS, select "FND Data" or "S/n data", select the Type of the object TABLE and you will get all the tables of EBS in module.

  • Hi, I'm developing a simple mobile app in DW CC 2015 using JQuery Mobile. LIKE I need the list view with description of the product, functionality and image, I would like to connect with database instead of "writing" all the tables in the bearings inside

    Hi, I'm developing a simple mobile app in DW CC 2015 using JQuery Mobile. LIKE I need the list view with description of the product, functionality and image, I would like to connect with database instead of "writing" all the tables in the bearings inside the Jquery page. In the future I would also be able to add, to remove the DB records. Any help, tutorial... Thanks TG

    I would like to connect with the database instead of "writing" all the tables in the bearings inside the Jquery page

    This is usually done with a CMS (content management system). There are commercial products CMS like WordPress, Joomla and perch. You create one or several layouts and then create pages of these page layouts using the CMS. In this way, it is possible to have hundreds of pages, each with unique content, but a page layout that can be managed in a place of sharing.

    CMSs on shelf don't require programming skills. Otherwise, some of us write our own CMS with custom functions, but this requires back-end, as with PHP programming.

  • I have a paid subscription of CC, but it keeps returning all the apps in the "trial" versions

    I have a paid subscription of CC, but on one two computers, it keeps returning all the apps to 'trial' often to 0 days versions. How do the versions "paid / activated ' stick?

    Hi C marwa,

    Please check the help below document:

    Creative Cloud applications unexpectedly back in the test mode. CS6, CCM

    Kind regards

    Sheena

  • Privilege for the creation and deletion of the indexes on all the tables/diagrams

    Hello

    I have a database running on the HPUnix bit ia64 platform. The version of the db is 10.2.0.3
    I have a schema named DPYBATCH.

    I need grant creation/deleting indexes on all the tables/diagrams.
    I know create a clue will solve the purpose of the creation. But I am confused with deleting indexes.

    If I give-> GRANT CREATE ANY INDEX OF DPYBATCH, it will not solve the purpose. He will have the privilege to be able to delete/move the index as well?
    If this is not the case, what is the privilege to grant to delete/move the index. Please let me know!

    Thank you!

    You must use DROP ALL INDEX: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8015.htm#i2066885.

  • Custom code to return all the selected items in a dynamic list

    Does anyone know of a custom code to return all the selected items in a dynamic list? Support told me that Dreamweaver does not return the last item. If anyone can give me a Tips how make this code custom or can direct me to code, I would be eternally grateful.

    Thanks to you two. I used the square brackets since they are in this season...

    No,

  • How to list all the tables that have no data

    Hi all


    I want to list all the tables that have no data. (registration number is 0)

    Someone help me.

    Thank you
    Thiensu2810

    Select owner, table_name from dba_tables where num_rows = 0;

    This assumes that the table statistics are COMMON.

  • Why ALIAS all the tables in the physical layer?

    I build a RPD and keep see message (s) where it is suggested to Alias all the tables in the physical layer.

    No reason?

    Y at - it a PDF file / site that lists best practices for the construction of an RPD?

    Thank you

    Published by: user10679130 on August 26, 2009 10:31

    In general, you may need to use more than 1 copy of a particular physical table. This means that you must use names of borrowing, even as you would in SQL. The advantage of using the alias is that when the physical table alias exchange all alias tables are changed automatically to change things in one place as if you created "copies" of the same physical table, you need to modify them one by one. We also use a naming convention names for each alias where the Dimensions get named Dim_ *, Fact_ * facts and bridge Tables Bridge_ * there has well listed more logically (in the way that you would use in the MDB layer).

Maybe you are looking for