Ask about the order of the column in a table

We have a table called EMP in several of our patterns. JOB is the third column in order. But in certain patterns, JOB is not the third column. I'm looking for patterns with EMP table where the column of EMPLOYMENT is not the third column.
SQL > desc emp
 Name                                      Null?    Type
 ----------------------------------------- -------- --------------
 EMPNO                                     NOT NULL NUMBER(4)
 ENAME                                              VARCHAR2(10)
 JOB                                                VARCHAR2(9)
 MGR                                                NUMBER(4)
 HIREDATE                                           DATE
 SAL                                                NUMBER(7,2)
 COMM                                               NUMBER(7,2)
 DEPTNO                                             NUMBER(2)


select column_name, column_id from dba_tab_Cols where 
TABLE_NAME = 'EMP' AND OWNER = 'SCOTT' order by column_id;

COLUMN_NAME                     COLUMN_ID
------------------------------ ----------
EMPNO                                   1
ENAME                                   2
JOB                                     3       --------Third column
MGR                                     4
HIREDATE                                5
SAL                                     6
COMM                                    7
DEPTNO                                  8
select
  owner
from
  dba_tab_Cols
where
  TABLE_NAME = 'EMP' AND
  OWNER = 'SCOTT' and
  column_id != 3;

Tags: Database

Similar Questions

  • I already bought the annual plan, I have installed PS, but I can't open the LR, he keeps asking about the serial No.

    I already bought the annual plan, I have installed PS, but I can't open the LR, he keeps asking about the serial No.

    isn't the annual plan for ps and lr?

    Download LR you remove and reinstall your installation of Photoshop Lightroom 5?  Licensing for your membership apply to Lightroom if you install through the creative Cloud Desktop application.  You can find more details at install and update the apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.

  • Find the name of the column in all tables

    How to find the name of the column in all tables in the database for any column to reveal the name of the person?


    We have over 1000 tables looking for.and in some places, the name column FNAME LNAME, First_NAME, DNAME

    For example we have Customer table, Table EMPLOYEE and the ORDER Table

    --------------------------------

    Customer table
    --------------------------------

    LNMAE

    EMPLOYEE table

    EMP_ID
    DEPT_NAME (we don't want this column as it is not a name column)
    Last_name (he must propose this column because it is named)

    ----------------------------

    CONTROL Panel

    -----------------------------

    ORDER_ID
    ORDER_NAME (we don't want this column as it is not a name column)
    Last_name (he must propose this column because it is named)

    -------------------------

    Dept table

    -------------------------

    Dept_ID
    DEPT_NAME (we don't want this column as it is not a name column)

    Please advise...

    Thank you.

    Hello

    What exactly do you do?

    If you want to display the tables containing these columns, you can query the view data dictionary USER_TAB_COLS (or ALL_TAB_COLS, or, if you have privileges, DBA_TAB_COLS).

    For example:

    SELECT table_name, column_name

    Of user_tab_cols

    WHERE nom_de_colonne IN ('DNAME', 'FNAME', 'FIRST_NAME', 'LAST_NAME', 'LNAME') - or else

    ORDER BY table_name, column_name

    ;

  • Update the value of the column based on another value of the column to another table

    Hi all

    I have something very confused me and need your help.

    Having two tables A and B.

    Table A have 2 column (+ id + and desc1)

    Table B have column 2 also (+ transnum + and desc2)

    Now, I want to update the column desc2 of table B identical desc1 of table was where transnum of Table B same as the id of the table has.

    I use this SQL

    update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1

    but this error occurs

    Error from line 5 in order:
    update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1
    Error in the command line: 5 column: 35
    Error report:
    SQL error: ORA-00933: SQL not correctly completed command
    * 00933. 00000 - "command not properly ended SQL."
    * Question: *.

    * Action. *

    Hope someone can help me. TQ for help...
    SQL> create table a1 (id number(2),des varchar2(10));
    
    Table created.
    
    SQL> create table b1 (transnum number(2),des varchar2(10));
    
    Table created.
    
    SQL> insert into a1 values (1,'maran');
    
    1 row created.
    
    SQL> insert into b1 values (1,'ram');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> update b1 set des=(select des from a1 where b1.transnum=a1.id);
    
    1 row updated.
    
    SQL> select * from b1;
    
      TRANSNUM DES
    ---------- ----------
             1 maran
    
  • Deactivation of the column in a table based on the setting in the search box

    Hi all

    I use Oracle Apex 4.1. I have two region

    1. search box

    2. in the form of a table

    In the search box, I have a LOV field where the user can select the value. Based on this LOV in the search box, tabular column f06 must disable or read-only.

    For example if I select THREE in LOV then only column f06 is expected on the other it must disable. How to get there.

    Thanks in advance

    Ravi

    Hi Bobo,

    Hope link below will solve your query.

    Disable the column in a table.

    BR,

    Patrick

  • How can I know the Position of the column in a table

    Hi all
    How can I know the position of the column in a table...
    For example: -.
    I have a table

    DESC EMPLOYEES

    EmpID
    Ename
    SAL

    I want to know the Empid is in 1st position, ename is 2nd and sal is in 3rd place.

    is this possible?

    SELECT *.
    Of user_tab_cols
    WHERE table_name = 'EMP ';

    Concerning
    Arun

  • Ask about the structured storage of XMLTYPE column in Oracle Xml db

    Dear all,

    Version of DB: Oracle 11g (11.2.0.3.0)

    I have a table with an XMLTYPE column with a structured storage.

    CREATE TABLE Orders
        (
        Order_id NUMBER NOT NULL,
        Order_etc VARCHAR2(100),
        Order_desc XMLType NOT NULL
        )
        XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA  "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
    

    I then recorded the XSD XML Db schema that is required for the structured storage.

    Before the creation of the table, I had created a table XMLTYPE (db_objects) and was able to use the query to verify that all objects, the XMLTYPE table got broken into when I signed his XSD below.

        SELECT column_name,      
               data_type
        FROM   user_tab_cols
        WHERE  table_name = 'DB_OBJECTS';
    

    And used under query to find data stored in the object-relational structure for my table (DB_OBJECTS) created with definition of XMLTYPE.

      SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER')       AS owner
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID')   AS object_id
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED')     AS created
        FROM   db_objects do
         ,      TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq  
        WHERE  ROWNUM <= 10;
    

    Now could someone let me know, How to find how the column of XMLTYPE (Order_desc) was divided between other objects, just as I did for the Table with XMLTYPE (as shown above)?

    Thank you very much.

    First of all, because you are on 11.2, ExtractValue is obsolete and the documentation lists three options to use instead.  Here's an (untested) option

    SELECT owner, object_name, object_type, object_id, created
      FROM db_objects do,
           XMLTable('/ROWSET/THISROW'
                    PASSING do.object_value
                    COLUMNS
                    -- Set data types accordingly
                    owner        VARCHAR2(20) PATH 'owner',
                    object_name  VARCHAR2(20) PATH 'object_name',
                    object_type  VARCHAR2(20) PATH 'object_type',
                    object_id    VARCHAR2(20) PATH 'object_id',
                    created      VARCHAR2(20) PATH 'created');
    

    Secondly, why the column order matter?  You store in a method of object / relational.  As long as the XML is valid per the schema, Oracle will be able to store the data and thus to retrieve later.  How these data are mainly internal Oracle and shouldn't be touched because it can be changed from one version to another.  You can use the schema annotation to control how Oracle cards and stores the XML content, but nothing in there specifies the column order I know.

    It seems several details are missing information which could help others to answer your question as to what you need.

  • Ask about the feature find my phone

    Hello Apple support Team,

    I have a question about the find my iPhone feature which is as follows.

    -If I had put in place the "find my phone" feature when I bought the iPhone and did not open at all in 2-3 months. So that the disconnection of the app itself?

    I ask this because my phone got stolen yesterday and looking for opportunities that could have gone wrong.

    On my laptop, I'm always a corner of yesterday in front of https://www.icloud.com/#find to find the location, but its doesn't help not.

    (PS: this my second time that find my iPhone is not useful for me, I really wish that Apple must lock the turning the option off when the phone is in mode Code (lock mode))

    Waiting for your response.

    Thank you

    Ravi

    If you enable find my iPhone, it will be on except if you have disabled (requires your password to iCloud).  The location will only show if the phone is connected to a network and still has the power.

  • Ask about the policy of replacement of defective parts under warranty (laptop)

    Hello. I had a laptop computer with a HARD drive 320, which became faulty (not totally, in fact) within 2 weeks of purchase. I turned it a HP service center and they got it replaced with a new job. Now everything works fine ATM, however I have noticed that my current HARD drive is a Western Digital while I remember that I had before the failure was a one Seagate. Now, I have a question about the HP replacement policy: is it possible to get another brand of HARD drive altogether in lieu of one that was part of the original shipment or should I have obtained one of the same company (Seagate) otherwise the same exact model of the HARD drive as a replacement?

    They replace it by what they have there at the time, any policy on this.

    This is a forum to a user, no employee of HP here, with the exception of the moderators of the forum.

    WD is currently better than Seagate in my opinion.

    .

  • Ask about the segregation of database access by using the authentication of the os in the windows environment

    Hello

    I have a question about the segragation of database access using authentication of the os (like sqlplus "/ as sysdba") in the windows environment. Let me briefly explain my requirement: -.

    Assume that you have two DBA viz DBA1 and DBA2 and 4 resideds of databases in a windows server say A, B, C and D.Now I want to configure it in a way if DBA1 opens a session on the server then it may connect to the database A and B using only OS and DBA2 authentication can connect to database C and D only use OS authentication.

    Please let me know how to configure for this requirement.

    Version of the database is 11.2.0.3

    Hello

    This doc is 11.1 but I guess it's the same in 11.2 roles on Windows and administering external users

    You create a group ORA_SID_DBA and doing it this way - in recent years I have done but it used to work ok...

    See you soon,.

    Harry

  • Ask about the creation and filling I$ table on different condition

    Hello
    I have a question about the creation and filling I$ table on a different condition. In which condition the I$ table creation? And these conditions are given below:

    (1) * source and transit area * are on the same server (that is to say target is located on another server)
    (2) * gathering and target area * are on the same server (IE source is on another server)
    (3) * source, transit area and target * are * different 3 * Server
    Source 4), area transit and target are on the same server
    Thank you

    I'm not quite clear to your question. Always try my best to erase it.

    In your all over requirement I$ table will be created.
    If the same staging as target (a database, a user) then all temporary tables are created in this user
    If the scaffolding is different from the target (a database, two users (A, B)), then all temporary tables will be created under that user A (lets consider) and the data will be inserted into the target table that is present to user B

    Staging is different from the target (two database, two users (A1, A2), architecture not recommended) if all temporary tables will be created under that user A1 (A1 of the databases) and the data will be inserted into the target table which is present in user A2 (A2 data base)

    If the source, staging, the target will be under a database then no. LKM is required, IKM is sufficient to load the data into the target. Especially for this, you can see an example given by Craig.
    http://S3.amazonaws.com/ora/ODI-Simple_SELECT_and_INSERT-interface.swf

    Thank you.

  • Ask about the 'top' of Linux on Linux for oracle user command

    It's the output of the 'top' command in one of my linux server hosting an Oracle instance with SGA 600 MB and 400 MB PGA. One instance is in this server.


    Top - 14:36:37 04:26, 3 users, load average: 0.05, 0.11 0.28
    Tasks: 124 1 total, running, 123 sleeping, 0 stopped, 0 zombie
    CPU: 0.2% us, sy 0.1% 0.0% ni, 66.6% id, 33.1% wa, 0.0% Hi, 0.0% if
    MEM: 12299332 k total, * 2569836 k * used, 9729496 k free, 61288 k buffers
    Swap: 20972816 k total, 0 k used, 20972816 k, 2274852-free updated k cached

    PID USER PR NOR VIRT RES SHR S % CPU % MEM TIME + COMMAND
    6345 oracle 16 0 37132 1752 1172 S 0,0 0,0 0:00.08 sshd
    6346 oracle 16 0 54004 1536 1208 S 0,0 0,0 0:00.02 bash
    6423 45376 0 16 10 oracle m 6228 S 0.0 0.1 0:00.25 tnslsnr
    6471 oracle 16 0 740 m 17 m 13 m S 0.0 0.1 0:00.02 oracle
    6473 oracle 16 0 739 m 15 m 12 m S 0.0 0.1 0:00.01 oracle
    6475 oracle 16 0 739 m 32 m 29 m S 0.3 0.0 0:00.07 oracle
    6477 oracle 16 742 m 0 50 m 44 m S 0,0 0,4 0:00.27 oracle
    6479 oracle 16 754 m 0 23 m 19 m S 0.0 0.2 0:00.43 oracle
    6481 oracle 16 0 739 m 24 m 20 m S 0.0 0.2 0:00.61 oracle
    6483 oracle 16 740 m 0 88 83 m m S 0.7 0.0 0:00.71 oracle
    6485 oracle 16 0 739 m 22 m 19 m S 0.0 0.2 0:00.01 oracle
    6487 oracle 16 0 740 m 30 m 25 m S 0.3 0.0 0:00.15 oracle
    6489 oracle 16 741 m 0 55 m 48 m S 0.0 0.5 0:00.29 oracle
    6491 oracle 16 0 739 m 24 m 20 m S 0.0 0.2 0:00.01 oracle
    6493 oracle 16 0 739 m 15 m 11 m S 0.0 0.1 0:00.01 oracle
    6495 oracle 16 0 739 m 14 m 11 m S 0.0 0.1 0:00.00 oracle
    6622 oracle 16 739 m 0 m 16 m 13 S 0.0 0.1 0:00.00 oracle
    6626 oracle 16 740 m 0 79 74 m m S 0.7 0.0 0:01.95 oracle
    6636 oracle 16 0 740 m 28 m 23 m S 0.0 0.2 0:00.06 oracle
    6638 oracle 16 0 739 m 16 m 12 m S 0.0 0.1 0:00.01 oracle
    6846 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.02 oracle
    6848 oracle 16 0 739 m 24 m 21 m S 0.0 0.2 0:00.04 oracle
    6850 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.02 oracle
    6852 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.01 oracle
    6854 oracle 16 0 739 m 30 m 26 m S 0.3 0.0 0:00.12 oracle
    6856 oracle 15 0 739 m 28 m 24 m S 0.0 0.2 0:00.18 oracle
    6858 oracle 15 0 740 m 40 m 35 m S 0.3 0.0 0:06.39 oracle
    6862 oracle 16 0 739 m 32 m 28 m S 0.3 0.0 0:02.25 oracle
    6864 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.02 oracle
    6866 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.03 oracle
    6868 oracle 16 0 739 m 19 m 16 m S 0.0 0.2 0:00.02 oracle
    7480 oracle 15 0 37264 1668 1092 S 0,0 0,0 0:00.15 sshd
    7481 oracle 15 0 54004 1528 1196 S 0,0 0,0 0:00.05 bash
    10333 oracle 16 0 739 m 20 m 16 m S 0.0 0.2 0:00.00 oracle
    10337 oracle 15 0 6168 1080 768 R 0,0 0,0 0:00.00 top

    RAM total as seen from the high command is 12G.
    * 2569836 *-total RAM that is currently used.

    How I see the total RAM used by all Oracle processes running on that server. The server is Linux X 86 64 bit. I can summarize the values under the column 'VIRT' command 'top' to see the total RAM used?

    Is it possible to see the total RAM and CPU used by top Oracle?


    "VIRT" is the virtual memory - what is related to the figure above, which is the physical memory (RAM)?

    Thanks in advance
    SSN

    Published by: SSNair on October 21, 2010 02:39

    Oracle used shared memory to implement the CMS, which was the largest consumer of memory of the Oracle instance. The problem is that in of many modern operating system, including linux, it is difficult to define the use of memory real fo software. This is because the memory used by a process consists of shared (for example, shared memory, shared library, executable code) and private components (for example, the heap, stack). Utilities such as top, ps, etc. provides all the visible memory through a process, regardless of whether or not it is shared. Accordingly, the total amount of VIRT etc. will be inflated by shared components. A more accurate figure of the use of memory, shared memory / library / code should be counted once.

    Before 11g, Oracle used System V ipc, and it is possible to control the amount of memory allocated by using IPCS. 11 g, Oracle passed to/dev/SHM, use df to check memory allocation. (Thanks user11150436)

    The figure of "Mem used" in the upper part is the actual use of memory: shared memory and the library are not counted multiple. However, Linux always puts in cache (read before actually requested) and disk i/o buffer (writing after completion of signaling). Therefore, "Used Mem" is almost always of very nearly the amount of physical memory. "Used Mem' - 'buffers' - 'cached' reflects the memory actually used by the operating system and all the programs most accuately.

    And you can use the pmap utility to check the memory card. Can classify you the use of memory sharable and unsharable to calculate a more accurate result, adapted to your need. You need knowledge of OS to understand the output.

  • Ask about the types of objects

    Hello

    I have a question about the type of object. I want to see the script for the type of object created, that is already stored in the database. How can I see who


    Concerning

    Hello

    So, you can try [DBMS_METADATA. GET_DDL | http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_metada.htm#ARPLS640]...

    MHO%xe> create or replace type mytype as object( col varchar2( 10 ));
      2  /
    
    Type is aangemaakt.
    
    Verstreken: 00:00:00.37
    MHO%xe> select dbms_metadata.get_ddl('TYPE', 'MYTYPE') from dual;
    
    DBMS_METADATA.GET_DDL('TYPE','MYTYPE')
    ------------------------------------------------------------------------------
    
      CREATE OR REPLACE TYPE "MHO"."MYTYPE" as object( col varchar2( 10 ));
    
  • collection of panels reorder and hide the columns of af: table

    Dear Experts,

    I use JDev 11.1.1.7.0.

    I would like to customize the model from the collection of a table so that I can set the Visible property of each column and displayIndex.

    How can I replace the model of collection related to the af data: table in order to browse the columns and set these properties?

    Best regards, Atanas.

    Hello

    On the bean of the jsf/jspx page of your table, where you set your table method, you must code as follows:

    public void setYourTable(RichTable t1) {
        this.YourTable = t1;
    
        List list = t1.getChildren();
            for (UIComponent component : list ){
                if (componente instanceof RichColumn){
    
            ((RichColumn)componente).setDisplayIndex(theOrderNumberYouWantoToSetToTheColumn);    //set a number order to the column of the table
            ((RichColumn)componente).setVisible(true/false);                    //true or false to show or not
    
            }
        }
    
    }
    

    For each column, you must set the number columns are ordered by, and whether they are visible or not.

    Kind regards

    Carlos

  • Can be parallelized Alter the dimensions of the column to change tables

    Hi all

    Can be parallelized Alter tables to the dimensions of the column to change.

    I was able to set the explain plan of parallelized command CREATE INDEX and CREATE TABLE STATEMENTS and view the plan of the explain command.
    But when I try to apply the market in PARALLEL for an ALTER TABLE to change column size, explain the plan is a failure.

    Ex:
    EXPLAIN THE PLAN TO ALTER / * + PARALLEL (10) * / EMP_BLKP_1 TABLE MODIFY ENAME VARCHAR2 (40);
    ORA-00900: invalid SQL statement

    But when I run the alter even outside the plan to explain that it works very well. But I don't know if parallelism is applied for that change the order.

    Receive your answer.

    Thank you
    NKM

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/sql_elements006.htm#SQLRF50801

    >
    The PARALLEL indicator tells the optimizer to use the specified number of concurrent servers for parallel operation. The indication applies to SELECT it, INSERT, MERGE, update, and DELETE portions of a declaration, as well as for the table scan part. If no parallel restriction is violated, the flag is ignored.

Maybe you are looking for

  • I lose mail on my computer when I change my POP IMAP accounts?

    I have mail in the usual places: inboxes Envoy project trash the in a multitude of folders on my Mac which I think are safe and it is those above, I need to go out and trash or store befor converting IMAP, Yes? They are all out of the BTW server and

  • Dx7500 No. DVD decoding program

    Hello I ordered 26 HP dx7500 microtours and began to perform a unboxing them conversion.  I work in a library, and some of the staff asked me on DVD playback on computers since the drive supports.  I have released the computers after you restore Wind

  • Case Structure sequence does not move to the next iteration

    Hello I am trying to create a multifunction data acquisition and control of a laboratory instrument. As shown in the attached VI, I finally 3 different modes: simple, door double door and GC, each with their own functionality. So far, I worked only o

  • Will it affect my warranty?

    Hi guys,. I recently bought an Acer Aspire that comes pre-installed with Windows 8. Windows 8 and I get not too well and I want to install Windows 7 on it. Will this void my warranty? Or my hardware warranty will still be effective? I have the standa

  • No explorer.exe, no office, only taskmanager

    I need serious help, please. I have a problem with explorer.exe running, and I have no office. Whenever I try to run explorer.exe from the Task Manager, I get the error "Windows Explorer has stopped working". The Task Manager are the only way to mana