SQL Developer dropping first column in a SQL SELECT

Am not too certain who to report this to... but I just noticed that SQL Developer will not return the first column in a SELECT statement when there is a comment just after the SELECT reserved word when running the query in the SQL Worksheet. For instance:
SELECT -- > HEADER INFORMATION STARTS HERE <--
w.stu_id HDR_STU_ID,
w.wiser_id HDR_WISER_ID,
iep.wiep_id HDR_WIEP_ID,
sis.wisis_id HDR_WISIS_ID,
FROM wiser_exit exit
INNER JOIN wiser w
ON exit.wiser_id = w.wiser_id
INNER JOIN wiser_iep iep
ON w.wiser_id = iep.wiser_id
INNER JOIN vw_wiser_iep_sis sis
ON iep.wiep_id = sis.wiep_id
will just return columns 2 - 4 (HDR_WISER_ID, HDR_WIEP_ID, and HDR_WISIS_ID), and NOT column HDR_STU_ID.
I verified this by running the same query in SQL Commands in the SQL Workshop of APEX, and the resultset returned all the columns including HDR_STU_ID.
Just ran another quick test in SQL Developer, and get the same results from a SELECT against a single table:
SELECT -- > HEADER INFORMATION STARTS HERE <--
county_cd,
odd_even_flg,
street_name
FROM dime
Did not return the county_cd column.
I know, it's just a minor quirk, but I thought I would mention it.

John,
Thank you. I replaced the '--' comments with the '/*' '*/' style and it picked up the first column.
I guess I'll just have to break an old habit I've been doing for years for comments. Dang, I hope all that old code doesn't break...
Thomas
Spoke too soon. I followed up by checking what Oracle's 'Oracle Database 10g The Complete Reference' had to say about the issue of using '--' for comments and under '-- (Comment)' it says "-- tells oracle a comment has begun. Everything from that point to the end of the line is treated as a comment. These delimiters are used only within SQL itself or in PL/SQL ..."
So I guess I can continue using '--', but need to keep in mind that in certain circumstances it might not work as expected. YMMV
Edited by: Thomas 8246 on Feb 19, 2010 8:09 PM

Similar Messages

  • (JTable) How can i get the first columns cell in a selected row?

    Hello. I am trying to figure out how i can get the first columns cell within a selected row no matter what cell is selected in that row. I have a class that extends AbstractTableModel which represents the table. Now i have another class that extends DefaultSelectionModel. Each model is added to the JTable via setModel(TableModel dataModel), setSelectionModel(ListSelectionModel newModel). Now i don't understand what i have to return from getMaxSelectionIndex(). Any ides? Thanks.
      class xTableModel extends AbstractTableModel{
         private static String[] cols;
         private Object[][] data;
            public void setTableModel(Object data[][], String[] cols){
             this.cols = cols;
             this.data = data;
            public String getColumnName(int col){
             return cols[col];
            public int getRowCount() {
             return data.length;
            public Object getValueAt(int row, int col) {
             return data[row][col];           
            public void setValueAt(Object value,int row,int col){
             data[row][col]=value;
            public int getColumnCount(){
             return cols.length;
    class ColumnListenerModel extends DefaultListSelectionModel{
         public int getMaxSelectionIndex(){}

    int row = table.getSelectedRow();
    Object data = table.getValueAt(row, 0);

  • SQL Loader Inserts chr(13) and chr(10) in the first column of every row.

    Hi,
    I have exported a data in a pipe delimited file using TOAD in one database. Now I want to load the data in my local database using SQL Loader. However every time I try to load the data a double quote followed by a new line is entered for the first column of each row. Unfortunately the delimited file is very big and hence can't be posted here. However I tried the same with a customized table and its data and found the same problem. Below are the table structures and control file that I used.
    create table test_sql
    a varchar2(30),
    b date
    insert into test_sql values('51146263',sysdate-3);
    insert into test_sql values('51146261,sysdate-1);
    EXPORTED PIPE DELIMITED FILE_
    A|B|!##!
    51146261|04/14/13 4:55:18 PM|!##!
    51146263|04/12/13 4:55:32 PM|!##!
    create table test_sql1 as select * from test_sql where 1=2;
    CONTROL FILE_
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE 'C:\Users\Prithwish\Desktop\Test.txt' "str '!##!'"
    PRESERVE BLANKS
    INTO TABLE TEST_SQL1
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    A CHAR(2000),
    B DATE "MM/DD/YYYY HH12:MI:SS AM"
    select * from TEST_SQL1;
    After this when I paste it in notepad I get the following result
    A B
    51146261"     14-APR-0013 16:55:18
    51146263"     12-APR-0013 16:55:32.
    I have no idea how the quotes or the newline appear. Is this a Toad bug? Any help would be greatly appreciated. Really urgent.
    Thanks in advance
    Regards

    Hi Harry,
    I actually thought that the str !##! was causing the problem. Actually my original export has some new lines in some specific columns so I can't keep the new line as my line terminator and hence I kept the !##! as my terminator.
    When I put the same data in a notepad and load it there is no problem at all. For e.g I just typed the following in a notepad and the data loaded just fine.
    A|B|!##!
    51146261|01-01-01 10:10:10 AM|!##!
    51146263|01-01-01 11:11:11 AM|!##!
    Its just when I load the exported file there the problem arises though I have verified the file using UNIX as well using octal dump and found no hidden characters.
    Regards,
    Prithwish

  • SQL SELECT DROPPING LEADING ZEROS

    Has anyone run accross the problem of Oracle 10g dropping the leading zeros on a Varchar field when you select the value?? Do you know the fix?

    SQL> desc pa_Students;
    Name Null? Type
    ID NOT NULL NUMBER(22)
    SQL> select distinct id from pa_students;
    ID
    2841
    2843
    2846
    2861
    2867
    2873
    2890
    2892
    2903
    9 rows selected.
    SQL> select distinct to_char(id,'000000000') from pa_students;
    TO_CHAR(ID,'000000000')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    SQL> select distinct lpad(id,9,'0') from pa_students;
    LPAD(ID,9,'0')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    The problem is that I need to first have the leading zeros. I also need to select multiple fields, but
    because of all of the extra spaces to the right of the data, everything I pick gets wrapped around. This
    never happened until we moved to an Oracle 10g database.

  • How many columns a sql selects

    I need to find out how many columns are in a sql statement like below:
    sql = "select id, decode(description,'','No decription', description), comment from my_table";
    The sql string is build dynamically so I don't know it when I write the code. I need to know before I do
    call rs.next(), because I need to set up the table header so I need to know how many columns the sql is selecting.
    Thanks inadvance.
    Botao

    You can use the interface ResultSetMetaData,below are some methods of it.
    int getColumnCount()
    Returns the number of columns in this ResultSet object.
    String getColumnName(int column)
    Get the designated column's name.
    int getColumnType(int column)
    Retrieves the designated column's SQL type.
    for more infomation ,you can refer to JDBC Online Document.

  • Using column number inplace of column name in SQL Select statement

    Is there a way to run sql select statements with column numbers in
    place of column names?
    Current SQL
    select AddressId,Name,City from AddressIs this possible
    select 1,2,5 from AddressThanks in Advance

    user10962462 wrote:
    well, ok, it's not possible with SQL, but how about PL/SQL?As mentioned, using DBMS_SQL you can only really use positional notation... and you can also use those positions to get the other information such as what the column is called, what it's datatype is etc.
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_rowcount  NUMBER := 0;
    BEGIN
      -- create a cursor
      c := DBMS_SQL.OPEN_CURSOR;
      -- parse the SQL statement into the cursor
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      -- execute the cursor
      d := DBMS_SQL.EXECUTE(c);
      -- Describe the columns returned by the SQL statement
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      -- Bind local return variables to the various columns based on their types
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
        END CASE;
      END LOOP;
      -- Display what columns are being returned...
      DBMS_OUTPUT.PUT_LINE('-- Columns --');
      FOR j in 1..col_cnt
      LOOP
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                                  when 2 then 'NUMBER'
                                                                                  when 12 then 'DATE'
                                                         else 'Other' end);
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('-------------');
      -- This part outputs the DATA
      LOOP
        -- Fetch a row of data through the cursor
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        -- Exit when no more rows
        EXIT WHEN v_ret = 0;
        v_rowcount := v_rowcount + 1;
        DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
        DBMS_OUTPUT.PUT_LINE('--------------');
        -- Fetch the value of each column from the row
        FOR j in 1..col_cnt
        LOOP
          -- Fetch each column into the correct data type based on the description of the column
          CASE rec_tab(j).col_type
            WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
            WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
          END CASE;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('--------------');
      END LOOP;
      -- Close the cursor now we have finished with it
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    DEPTNO - NUMBER
    SAL - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    DEPTNO : 10
    SAL : 2450
    Row: 2
    EMPNO : 7839
    ENAME : KING
    DEPTNO : 10
    SAL : 5000
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    DEPTNO : 10
    SAL : 1300
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    JOB - VARCHAR2
    MGR - NUMBER
    HIREDATE - DATE
    SAL - NUMBER
    COMM - NUMBER
    DEPTNO - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    JOB : MANAGER
    MGR : 7839
    HIREDATE : 09/06/1981 00:00:00
    SAL : 2450
    COMM :
    DEPTNO : 10
    Row: 2
    EMPNO : 7839
    ENAME : KING
    JOB : PRESIDENT
    MGR :
    HIREDATE : 17/11/1981 00:00:00
    SAL : 5000
    COMM :
    DEPTNO : 10
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    JOB : CLERK
    MGR : 7782
    HIREDATE : 23/01/1982 00:00:00
    SAL : 1300
    COMM :
    DEPTNO : 10
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from dept where deptno = 10');
    -- Columns --
    DEPTNO - NUMBER
    DNAME - VARCHAR2
    LOC - VARCHAR2
    Row: 1
    DEPTNO : 10
    DNAME : ACCOUNTING
    LOC : NEW YORK
    PL/SQL procedure successfully completed.
    SQL>

  • ORA-12983: cannot drop all columns in a table

    Hi,
    I am creating a table with two columns.
    I have modified a column as unused using ALTER statement.
    After that i have tried to drop the another column by using ALTER statement.
    But it throws an error ORA-12983: cannot drop all columns in a table.
    is it not possible to achieve this via ALTER statement?
    thanks

    is there any other way to find the name of the columns which have been marked as unused?Don't think so, and you would not be able to do much about. You won't be able to reference it, you won't be able to un-unuse it, and you would even be able to add a new column having same name.
    Why are you using SET UNUSED in the first place?
    Regards
    Peter
    Quoting myself:
    You won't be able to reference itMaybe not good enough:
    SQL> select column_name, data_type, segment_column_id
      from user_tab_cols
    where table_name = 'T';
    COLUMN_NAME                    DATA_TYPE   SEGMENT_COLUMN_ID
    SYS_C00001_11051618:28:14$     NUMBER                      1
    B                              NUMBER                      2
    SYS_C00003_11051618:28:14$     NUMBER                      3
    3 rows selected.
    select "SYS_C00003_11051618:28:14$" from t
    Error at line 1
    ORA-00904: "SYS_C00003_11051618:28:14$": invalid identifier
    SQL> alter table t drop column "SYS_C00001_11051618:28:14$";
    Table altered.
    SQL> select column_name, data_type, segment_column_id
      from user_tab_cols
    where table_name = 'T';
    COLUMN_NAME                    DATA_TYPE   SEGMENT_COLUMN_ID
    B                              NUMBER                      
    1 row selected.
    Note: Both columns "disappeared"  Thanks MichaelS
    Edited by: Peter on May 16, 2011 9:29 AM

  • Dropping unused columns from database table

    I have an existing table called TUSER. I have mapped some fields, but not
    all fields, as some are inserted by other applications and for reporting
    purposes.
    I am using JDK 1.3.1_02, Windows 2000, SQL Server 2000 database, Kodo
    JDOEE 2.2.6 and JBoss 3.0.0.
    When I refresh the datastore it drops all columns that are not mapped
    (note that these colums can contain null values):
    [java] [ connection: 2961925; statement: 2766626; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER ADD Job_Title_ID VARCHAR(255)
    [java] [ connection: 2961925; statement: 1582473; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MAILUSERID
    [java] [ connection: 2961925; statement: 5237832; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PHONENUMBERS
    [java] [ connection: 2961925; statement: 2191491; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMPLOYEENO
    [java] [ connection: 2961925; statement: 894443; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MDATE
    [java] [ connection: 2961925; statement: 531758; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN STATUSCHANGETIME
    [java] [ connection: 2961925; statement: 5899013; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN FINISHDATE
    [java] [ connection: 2961925; statement: 8146001; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDMBOARD
    [java] [ connection: 2961925; statement: 7756310; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN DEL_FLG
    [java] [ connection: 2961925; statement: 6817858; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_CD
    [java] [ connection: 2961925; statement: 7754670; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDREQUESTER
    [java] [ connection: 2961925; statement: 7332084; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MSG_SERVER
    [java] [ connection: 2961925; statement: 1691809; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN AUTORUN
    [java] [ connection: 2961925; statement: 5253969; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN REG_DATE
    [java] [ connection: 2961925; statement: 4977422; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_LST
    [java] [ connection: 2961925; statement: 4343712; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN ALLOWREPL
    [java] [ connection: 2961925; statement: 7104150; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMAIL
    [java] [ connection: 2961925; statement: 4395840; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MANAGERSTATUS
    [java] [ connection: 2961925; statement: 2417379; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MD5_DIGEST
    [java] [ connection: 2961925; statement: 2865120; time: Thu Jul 04
    15:33:25 JST 2002 ] ALTER TABLE TUSER DROP COLUMN SMTPADDRESS
    15:33:25 JST 2002 ] INSERT INTO JDO_SCHEMA_METADATAX(CLASSNAMEX) VALUES
    ('com.gulfnet.g
    roupcast.data.User')
    Is this meant to happen? I am guessing not. Is there a way to tell the
    schematool to not remove existing columns?
    Thanks in advance.
    Kam

    You can in fact tell the schematool not to drop columns it doesn't know about. When you run the schematool, use the "add" action rather than "refresh". Then it will only add columns, never drop them. See the documentation for details:
    http://www.solarmetric.com/Software/Documentation/2.2.5/manual.html#schema_manipulation

  • Can we convert a SQL (Select Statement) to Procedure.?

    Hi
    I am using a select sql for retrieving the results - Below is a sample sql select query.
    select TableC.DATEFIELD as QUERY_DATE,
    TableB.COLUMN1 PROCESS,
    TableC.COLUMN1 PRODUCT,
    sum(TableC.COLUMN4) as OPEN_INSTANCES
    from      TableA, TableB, TableC
    where TableB.COLUMN1      = TableA.COLUMN2
    and      TableA.COLUMN2      = TableC.COLUMN2
    and      DATEFIELD <= to_date('2011-02-02' ,'YYYY-MM-DD')
    and      DATEFIELD >= to_date('2011-02-02' ,'YYYY-MM-DD')
    and      TableC.COLUMN4 <= (24 * 3600 )
    and      TableB.COLUMN1 like 'PROCESSID'
    and      TableC.COLUMN1 in ('OSRCITR')
    group by TableC.DATEFIELD as QUERY_DATE,
    TableA.COLUMN1 PROCESS,
    TableC.COLUMN1 PRODUCT
    I believe if we use a Procedure, It would be much faster. Is there any way that we can convert the above select sql to a procedure. If yes, how can it be.
    Thanks in Advance.
    -Sreekant

    Sreekant wrote:
    select TableC.DATEFIELD as QUERY_DATE,
    TableB.COLUMN1 PROCESS,
    TableC.COLUMN1 PRODUCT,
    sum(TableC.COLUMN4) as OPEN_INSTANCES
    from      TableA, TableB, TableC
    where TableB.COLUMN1      = TableA.COLUMN2
    and      TableA.COLUMN2      = TableC.COLUMN2
    and      DATEFIELD <= to_date('2011-02-02' ,'YYYY-MM-DD')
    and      DATEFIELD >= to_date('2011-02-02' ,'YYYY-MM-DD')
    and      TableC.COLUMN4 <= (24 * 3600 )
    and      TableB.COLUMN1 like 'PROCESSID'
    and      TableC.COLUMN1 in ('OSRCITR')
    group by TableC.DATEFIELD as QUERY_DATE,
    TableA.COLUMN1 PROCESS,
    TableC.COLUMN1 PRODUCT
    I believe if we use a Procedure, It would be much faster. Is there any way that we can convert the above select sql to a procedure. If yes, how can it be.Using the code tags would make the query easier to read :)
    What version of Oracle are you on?
    Under the right conditions deconstructing a huge query into smaller components sometimes can offer performance increases, but this is more true of older versions of Oracle than recent ones. Lately I get better results from tuning queries in place - as Aman pointed out you introduce context switching (moving between the SQL and PL/SQL engines to do work) which can also hurt performance.
    Try tuning the query first. Get an execution plan. Things you can look for include
    * make sure the driving table is the best one
    * are the join columns properly indexed? Are existing indexes being suppressed due to the functions?
    Is "and      TableB.COLUMN1 like 'PROCESSID' " correct? without a wildcard LIKE should evalate to =

  • Convert sql select statement to oracle

    Hi All,
    Can anyone help me converting this Sql select statement to oracle ....
    -----------------------------------------Query--------------------------------------------------------------
    select emp_master.emp_code ,
    emp_master.dept_cd ,
    attendance_master.daily_attn_code ,
    attendance_master.linked_column ,
    case when location.payroll_status <> 'N' and eDocsNetEmployeesLeave.StartDate < dateadd(mm, 1 , convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01'))     
    then
    dateadd(mm, 1 , convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01'))
    when eDocsNetEmployeesLeave.StartDate < convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01')     
    then convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01') else eDocsNetEmployeesLeaveDetails.StartDate           
    end ,
    eDocsNetEmployeesLeaveDetails.NoOfDays,          
    case when eDocsNetEmployeesLeave.StartDate > location.next_pay_date     
    then convert(datetime , convert(varchar, dateadd(ss,-1, dateadd(mm, 1, convert(datetime , datename(yy,eDocsNetEmployeesLeave.StartDate)+ '/' + datename(mm,eDocsNetEmployeesLeave.StartDate)+ '/01') )),106) )     
    else      
    case when location.payroll_status <> 'N'
    then dateadd(mm,1,location.next_pay_date)      
    else location.next_pay_date
    end      
    end as PaymentDate               ,
    isnull(grade_master.leave_type,'C') ,
    eDocsNetEmployeesLeave.StartDate ,          
    eDocsNetEmployeesLeaveDetails.LeaveType
    from eDocsNetEmployeesLeave ,
    eDocsNetEmployeesLeaveDetails ,
    eDocsNetLeaveTypes ,
    emp_master ,
    grade_master ,
    attendance_master ,
    location
    where eDocsNetEmployeesLeaveDetails.RequestID     = eDocsNetEmployeesLeave.RequestID and
    eDocsNetEmployeesLeave.EmployeeID = emp_master.emp_code and
    eDocsNetEmployeesLeaveDetails.LeaveType = eDocsNetLeaveTypes.LeaveTypeID and
    eDocsNetLeaveTypes.loc_cd = emp_master.loc_cd and
    location.loc_cd = emp_master.loc_cd and
    attendance_master.loc_cd = emp_master.loc_cd and
    attendance_master.linked_column = eDocsNetLeaveTypes.LinkedAttendance and
    grade_master.loc_cd = emp_master.loc_cd and
    grade_master.grade_cd = emp_master.grade_cd and
    eDocsNetEmployeesLeaveDetails.RequestID      = @RequestID
    order by eDocsNetEmployeesLeaveDetails.StartDate
    Thanks in Advance
    Smiley

    Seems like you want to convert a SQL statement from the ??? dialect to the Oracle dialect. *(It would be useful to indicate the non-ANSI standard SQL you are starting with.)
    Part of the problem is that you use several date related functions. Some are unnecessary in Oracle and some need to translated into Oracle functions as found in the Functions section (chapter 5) of the SQL Reference manual at http://www.oracle.com/pls/db102/homepage
    Note that columns and expressions of type 'date' in ORacle always contain all of "yyyy mm dd hh mi ss" and you need to format and trauncate as necessary.
    Also note that '09-JAN-31' is NOT an Oracle date, but rather a character representation of a date which must be converted to/from a date expression. You will often need to use the to_date() and to_char() functions with a format mask as the second parameter. This is also descreibed in the first 2 chapters of the SQL Reference manual.

  • Dropping a column in composite xmltype table with virtual column

    Hello,
    i found some interesting behavior. I have a table with xmltype column and a virtual column. If i drop a column, which has an index smaller than the index for the xmltype column, than the virtual column reference for xmltype column is not changed.
    select * from v$version;
    drop table t_xml purge;
    create table t_xml( c1 number,
                        c2 number,
                        cxml xmltype,
                        c3 number,
                        xmlflag number as (nvl2(cxml,1,0)));
    select * from t_xml;
    alter table t_xml drop column c2;                    
    select * from t_xml; The 2nd select will result in error:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> alter table t_xml drop column c2;                    
    Tabelle wurde geändert.
    SQL>
    SQL> select * from t_xml;
    select * from t_xml
    FEHLER in Zeile 1:
    ORA-00904: "SYS_NC00004$": ungültiger BezeichnerNow the virtual column xmlflag references still the old hidden column for cxml (SYS_NC00004$). It not references the new hidden column, which is now SYS_NC00003$.
    I think, it is a bug! Can someone inform oracle? I have no access to metalink.

    Hi,
    Please try this code:
    loop at int_inv into wa_inv.
        lv_count = lv_count + 1.
        AT END OF posnr.   <------- The field you want to sum..
          gs_total-posnr      = wa_inv-posnr.
          gs_total-cov_total  = lv_count.
          APPEND gs_total TO gt_total.
          CLEAR : gs_total,
                  lv_count,
                  wa_inv.
        ENDAT.
      ENDLOOP.

  • Why should primary key be the first column in a table

    Hi,
    I'm trying to build a case to alter a table in production with a composite key . I have  PK columns at the start of table which is how it should be , but the issue is down the line , another column was added at the end and the same was added to composite
    key .
    issue is as PK arranges records physically where it creates a clustered index, as far as my knwoledge goes,  data is ordered initially by the three fields (composite keys) and then ordered again by another composite key field as they are not
    defined in a set , will this cause any performance bottle necks as it's a stage table to populate a fact if so how ??
     below is the table structure..
    Any help  in this regard is appreciated :)

    PRIMARY KEY as first column is just a convention.
    The PRIMARY KEY columns can be anywhere in a table.
    I don't see any advantage to the 5-column PRIMARY KEY.
    I would design it with INT IDENTITY (or SEQUENCE OBJECT) SURROGATE PRIMARY KEY.
    You can make the 5-columns a UNIQUE key or unique index.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Dropping Unused column

    Hi All,
    I am working on version 11.2.0.3.0 ( windows server 2008 ).
    While dropping unused column i am getting below error
    SQL> create table er (ab varchar2(50), aa varchar2(50)) compress;
    SQL> alter table er set unused column ab;
    Table altered.
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> alter table er drop unused columns;
    alter table er drop unused columns
    ERROR at line 1:
    ORA-39726: unsupported add/drop column operation on compressed tables

    i can't do such things for these number of tablesThat is the funniest thing I've heard in a while. If you can "alter table xxx drop unused columns," why can't you do what is suggested.
    And no, it's not a bug.
    And no, there is not "another way around"

  • Drop Multi-columns

    SQL> alter table TIME_RULES drop column
    2 ( VAC_TYPE ,DEC_FLAG ,BAL_VAL , CHK_WORK , CHK_AGE
    3 , BAL_ACC ); --, , , , ;
    ( VAC_TYPE ,DEC_FLAG ,BAL_VAL , CHK_WORK , CHK_AGE
    ERROR at line 2:
    ORA-00904: : invalid identifier
    Any Suggestions pls.?
    Regards,
    Abdetu..

    Remove the COLUMN Key work.
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.00
    SQL> create table t(a integer, b integer, c integer)
      2  /
    Table created.
    Elapsed: 00:00:00.00
    SQL> desc t
    Name                                      Null?    Type
    A                                                  NUMBER(38)
    B                                                  NUMBER(38)
    C                                                  NUMBER(38)
    SQL> alter table t drop (b,c)
      2  /
    Table altered.
    Elapsed: 00:00:00.01
    SQL> desc t
    Name                                      Null?    Type
    A                                                  NUMBER(38)Thanks,
    Karthick.

  • Dropping a column's default value

    How to drop a column's default value?
    The following commands fails:
    ALTER TABLE t1 ALTER COLUMN c1 DROP DEFAULT.
    ALTER TABLE t1 MODIFY c1 DROP DEFAULT.
    Thanks in advance.

    SQL> ALTER TABLE IDENTIFICADORES_DOMINIOS_RANGO MODIFY TIPO_DATO DEFAULT NULL;
    Table altered
    SQL> DESC IDENTIFICADORES_DOMINIOS_RANGO
    Name                 Type         Nullable Default Comments                                  
    CODIGO_IDENTIFICADOR NUMBER(7)                                                               
    DESCRIPCION          VARCHAR2(50)                                                            
    TIPO                 VARCHAR2(1)                                                             
    TIPO_DATO            VARCHAR2(1)           NULL    Tipo de dato que contiene el Dominio-RangoI would like drop DEFAULT value; now, it's marked like NULL. It's not the same... is it?

Maybe you are looking for

  • Adobe Viewer for Android Phone

    Hi guys, The Adobe Content Viewer from Google Play (May 1, 2013) is both compatible and works fine on my Nexus 4 phone. We understand that adding the Android phone compatibility might cause poor app rating as the buttons/controls will be hard to tap

  • Moving a Solaris Zone from one server to another

    Hello, I have a Solaris 8 zone running on a server. It is running on a ZFS file system. The hardware that it is running on is no longer under support contract, so we want to move it to our newer solaris hardware that still has support. I have done a

  • BAPI for asset disposal through tcode F-92

    Dear all, Is there any BAPI to perform asset disposal that posted in tcode F-92 in foreground with asset transaction type = 210? I found this BAPI BAPI_ASSET_RETIREMENT_POST however i did not find the field to enter the posting key + gl account info

  • Getting an error with Netflix app-

    I can pick a movie/show and hit play- it just "loads" and then comes up with an error.  I have tried everything: reset network settings, deleted app and reinstalled it, shut it off, signed out/in. not on Ipad just Iphone. Anyone else??? I called Netf

  • Error occured when installing the phase "Creating First Node"  MSCS

    Hi, I am Installing SAP ECC 6.0 on MSCS and in the 3rd phase of creating the First node the installation got stopped telling the SAP cluster group cant be created and after looking at the below log i found it says the disk is not in Share disk list.