Column name completion?

Hello,
Is column name completion available in the SQL editor? In other products you can usually type "select * from footable a where a." and it lists all columns in the table. At least it doesn't seem to be enabled by default and I didn't find anything in preferences
Nice look and overall feel in general.
Edit: it seems to work on "footable.". It would be nice to have it on aliases also.

It looks like autocomplete is broken in 897. When I type "select * from jfuda.dept." the cursor turns to an hour glass like its about to do something and then ... nothing ... no popup. (My Code Insight: Completion preferences are all checked, btw.)
Also, re. lower vs upper case, personally I prefer lower case, but I'm sure others would prefer upper case. How about inspecting the preceeding alias or table name and using whatever format it was typed in? For example, if I type "jfuda.dept.", I'd see a pick list with lower case values. If I type "JFUDA.DEPT.", an uppercase list of values would appear.

Similar Messages

  • Issue in Column NAMES Printing in SQLPLUS

    Hi All,
    I am connecting to 2 databases through a 10.1.0.4.2 Version of SQLPLUS.
    1st Database runs with - 10.2.0.4 Patchset
    2nd Database runs with - 10.2.0.1.0 Patchset
    From both the Databases we are running a long query with columns using Decode funtions. We are not able to see the column names completely in the 1st DB i.e 10.2.0.4 Patchset. Whereas in 2nd DB - Version 10.2.0.1.0 - Its working properly. I am not sure whether here DB version is the problem.
    This is the query i am firing from both DB's. Here in the 1st column with decode function doesnt prints the column heading in SQLPLUS.
    SELECT DECODE('ENG','ENG',A.PC_DESC,A.PC_DESC_BL)
    FROM PCOM_CODES A, PCOM_CODES_APPL_CODES B
    WHERE CAC_TYPE = 'VEH_CC_TYPE'
    AND A.PC_TYPE = CAC_PC_TYPE_2
    AND A.PC_CODE = B.CAC_PC_CODE_2
    AND ROWNUM < =2
    DECODE('ENG','ENG',A.PC_DESC,A.PC_DESC_BL) - This is the column name which doesnt prints properly in a 10.2.0.4.0 Database.
    Is there any specific User specific or DB specific setting for such issues. We dont want to use any alias column names for specific purpose to be handled with that column name.
    We have already tried out the following.
    1) All SQLPLUS environment variables like SET SERVEROUT ON SIZE etc.
    2) In the same PC where DB is installed.
    3) Checked even if its a Data issue but really not.
    4) We cannot set any alias column for this due to functional restrictions.
    I appreciate a quick response from the forum users on this issue.
    Thanks in advance.

    check this out.
    I still believe it is a formatting issue.
    SQL> select decode(empno,7369,job||hiredate||sal||deptno,deptno) from emp;
    /*Output */
    DECODE(EMP
    30
    20
    30
    20
    10
    /* now*/
    SQL> set line 1200;
    SQL>  select decode(empno,7369,job||hiredate||sal||deptno,deptno) from emp;
    DECODE(EMPNO,7369,JOB||HIREDATE||SAL||DEPTNO,DEPTNO)
    CLERK17-DEC-8080020
    30
    30
    20
    30
    30
    10
    20
    10
    30
    20
    try setting set line 1200 and then running that query.
    Cheers!!!
    Bhushan

  • Unable to reorder/change column names on interactive single row view

    I have created an interactive report and grouped my columns to display nicely in a single row view report. However, once I initially add the columns to a group, I am unable to reorder them. I can move them up and down the list, but the changes don't save. Also, I have gone through column by column and unchecked the box that says Use Same Text for Single Row View and expanded the column name. However, the single row view still displays what is in the master report. I've tried closing out my browser completely and reopening, but I am still not seeing my changes. Any suggestions?

    I also just stumbled about the "Use Same Text for Single Row View" option actually doing nothing - in Single Row View I still get the label text from "Column Heading", no matter what I enter in "Single Row View Label".
    I had to adjust a column width using a span tag in the heading (as this seems to be the only way to do that - any other suggestions I found adding style information to the region header had no effect), and now that tag is displayed in the Single Row View label.
    I can live with that for now, but it's not really nice.
    Is this a known bug? Didn't find anything else in the forum regarding this problem so far.
    Holger

  • Need to know the column names in my dynamic select clause

    Dear All,
    Please go through the following code. While executing the following code i am getting an error saying that dbms_sql.describe_columns overflow, col_name_len=35. Use describe_columns2.
    Please guide me how to proceed further. Or please help me, how can i get the column names when i issue a dynamic select clause.
    DECLARE
    CUR INTEGER;
    COL_CNT INTEGER ;
    A INTEGER;
    SEL_CLAUSE VARCHAR2(2000);
    DESC_T DBMS_SQL.DESC_TAB;
    REC DBMS_SQL.DESC_REC;
    b number;
    BEGIN
    SEL_CLAUSE := 'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'',3,''THREE'') FROM DUAL';
    --'SELECT ROWID,PARA_SUB_CODE,DECODE('||''''||'ENG'||''''||','||''''||'ENG'||''''||',PARA_NAME,PARA_BL_NAME),NULL,NULL FROM PCOM_APP_PARAMETER';
    --'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'') FROM DUAL';
    DBMS_OUTPUT.PUT_LINE( SEL_CLAUSE );
    CUR := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(CUR,SEL_CLAUSE,DBMS_SQL.NATIVE);
    DBMS_SQL.DESCRIBE_COLUMNS(CUR,COL_CNT,DESC_T);
    B := desc_t.first;
    FOR J IN 1..COL_CNT
    LOOP
    DBMS_OUTPUT.PUT_LINE('J := '||J || ' COL CNT ' || COL_CNT);
    END LOOP;
    BEGIN
    A := DBMS_SQL.EXECUTE(CUR);
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    END;
    Regards,
    Balaji

    Is there any way can i have it directly??It does not work with static SQL either. Dynamic SQL is no different.
    SQL> select 1 x from dual where x = 1 ;
    select 1 x from dual where x = 1
    ERROR at line 1:
    ORA-00904: "X": invalid identifier
    SQL>As suggested already, you will need to use alias if you want your select expression to be referred in the where clause.
    SQL> BEGIN
      2      FOR rec IN (SELECT *
      3                  FROM   (SELECT 1,
      4                                 2,
      5                                 DECODE(1, 1, 'ONE', 2, 'TWO', 3, 'THREE') "DECODE(1, 1, 'ONE', 2, 'TWO', "
      6                          FROM   DUAL)
      7                  WHERE  "DECODE(1, 1, 'ONE', 2, 'TWO', " = 'ONE')
      8      LOOP
      9          NULL;
    10      END LOOP;
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SQL>Message was edited by:
    Kamal Kishore

  • How can i export the data to excel which has 2 tables with same number of columns & column names?

    Hi everyone, again landed up with a problem.
    After trying a lot to do it myself, finally decided to post here..
    I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
    It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
    Because both the tables have same number of columns & column names.
    Below are 2 tables with column names:
    Table-1 (MONTHLY_PART_1)
    Table-2 (MONTHLY_PART_2)
    SL_NO
    SL_NO
    COMP
    COMP
    DUE_DATE
    DUE_DATE
    U-1
    U-1
    U-2
    U-2
    U-4
    U-4
    U-20
    U-20
    U-25
    U-25
    Since both the tables have same column names, I'm getting the following error :
    Error 402 at line 103, column 4
      alias required in SELECT list of cursor to avoid duplicate column names.
    So How can i export the data to excel which has 2 tables with same number of columns & column names?
    Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
    Help me with this please.
    Thank You.

    You'll have to *alias* your columns, not prefix it with the table names:
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id, b.id, a.val1, b.val1, a.val2, b.val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
      for rData in cData loop
    ERROR at line 18:
    ORA-06550: line 18, column 3:
    PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
    ORA-06550: line 18, column 3:
    PL/SQL: Statement ignored
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
    PL/SQL procedure successfully completed.
    cheers

  • Strange behavior in BI Publisher with long column names from BI Answers

    Hello all!
    I have created a BI Answers request with few calculated columns in form of
    case when <condition> then <value if true> else <value if false> end
    Then in BI Publisher Desktop designed a report ttemplate based on saved BI Answers request and noticed that for calculated columns their names look strange:
    CASEWHEN_<condition>THEN...ELSE..._...END__
    Some of the column names are about 100 characters long.
    After running the report from Word found that for these "long length named columns" there's no data in the output.
    Do someone else experience the same? Any workarounds?
    Regards,
    mr.maverick

    This is because the length for the formula is restricted in publisher. you have to either reduce the size of the column name in answers or change the formula. another workaround is completely pasting the formula directly in the word template instead of placing the formula inside the form field. you can add maximum of 300 characters i guess. you can edit the formula for the form field in the form field options formuals menu.

  • Please help me I am not seeing Database table column names in field explorer view

    Hi,
    I am developing a crystal report using eclipse and sql server. After creating connection, when i drag and drop tables, The table name and its columns should apper in field explorer view. Then we drag the columns onto crystal report. Unfortunately I am just  seeing only table names but not column names in field explorer view. Could anyone help me?
    After downloading eclipse I have plugged in the crystal report using the following instructions
    1. Click on the Help menu, and then Software Updates > Find and Install... to open the Install/Update wizard.
    2. Select Search for new features to install and click Next.
    3. Click the New Remote Site button. This will launch the New Update Site wizard
    4. Type the Business Objects Updsate Site for the Name field and the following for the URL: http://www.businessobjects.com/products/dev_zone/eclipse/
    5. Click OK to complete the wizard.
    6. Enable the newly created Business Objects Update Site checkbox as well as the Callisto Discovery Site (which should appear by default with Eclipse 3.2) and click Finish.
    Expand the Business Objects Update Site node and enable the Crystal Reports for Eclipse 1.0.0v555 checkbox.
    8. Expand the Callisto Discovery Site and click the button "Select Required". This will automatically select the required Eclipse features necessary to successfully install Crystal Reports for Eclipse.
    Thank You
    Rajavardhan Sarkapally

    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
    If you are using SQL Server 2012/2014, then you can use
    sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to get the column name and table name from xml file

    I have one XML file, I generated xsd file from that xml file but the problem is i dont know table name and column name. So my question is how can I retrieve the data from that xml file?

    Here's an example using binary XML storage (instead of Object-Relational storage as described in the article).
    begin
      dbms_xmlschema.registerSchema(
        schemaURL       => 'my_schema.xsd'
      , schemaDoc       => xmltype(bfilename('TEST_DIR','my_schema.xsd'), nls_charset_id('AL32UTF8'))
      , local           => true
      , genTypes        => false
      , genTables       => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS
      , options         => dbms_xmlschema.REGISTER_BINARYXML
    end;
    genTables => true : means that a default schema-based XMLType table will be created during registration.
    enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS : indicates that a repository resource conforming to the schema will be automatically stored in the default table.
    If the schema is not annotated, the name of the default table is system-generated but derived from the root element name :
    SQL> select table_name
      2  from user_xml_tables
      3  where xmlschema = 'my_schema.xsd'
      4  and element_name = 'employee';
    TABLE_NAME
    employee1121_TAB
    (warning : the name is case-sensitive)
    To annotate the schema and control the naming, modify the content to :
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xs:element name="employee" xdb:defaultTable="EMPLOYEE_XML">
        <xs:complexType>
    Next step : create a resource, or just directly insert an XML document into the table.
    Example of creating a resource :
    declare
      res  boolean;
      doc  xmltype := xmltype(
    '<employee>
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>'
    begin
      res := dbms_xdb.CreateResource(
               abspath   => '/public/test.xml'
             , data      => doc
             , schemaurl => 'my_schema.xsd'
             , elem      => 'employee'
    end;
    The resource has to be schema-based so that the default storage mechanism is triggered.
    It could also be achieved if the document possesses an xsi:noNamespaceSchemaLocation attribute :
    SQL> declare
      2 
      3    res  boolean;
      4    doc  xmltype := xmltype(
      5  '<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6             xsi:noNamespaceSchemaLocation="my_schema.xsd">
      7    <details>
      8      <emp_id>1</emp_id>
      9      <emp_name>SMITH</emp_name>
    10      <emp_age>40</emp_age>
    11      <emp_dept>10</emp_dept>
    12    </details>
    13   </employee>'
    14   );
    15 
    16  begin
    17    res := dbms_xdb.CreateResource(
    18             abspath   => '/public/test.xml'
    19           , data      => doc
    20           );
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> set long 5000
    SQL> select * from "employee1121_TAB";
    SYS_NC_ROWINFO$
    <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>
    Then use XMLTABLE to shred the XML into relational format :
    SQL> select x.*
      2  from "employee1121_TAB" t
      3     , xmltable('/employee/details'
      4         passing t.object_value
      5         columns emp_id   integer      path 'emp_id'
      6               , emp_name varchar2(30) path 'emp_name'
      7       ) x
      8  ;
                                     EMP_ID EMP_NAME
                                          1 SMITH

  • How to make dynamic query using DBMS_SQL variable column names

    First of all i will show a working example of what i intend to do with "EXECUTE IMMEDIATE":
    (EXECUTE IMMEDIATE has 32654 Bytes limit, which isn't enough for me so i'm exploring other methods such as DBMS_SQL)
    -------------------------------------------------CODE-----------------------------------
    create or replace PROCEDURE get_dinamic_query_content
    (query_sql IN VARCHAR2, --any valid sql query ('SELECT name, age FROM table') 
    list_fields IN VARCHAR2) --list of the columns name belonging to the query (  arr_list(1):='name';   arr_list(2):='age';
    -- FOR k IN 1..arr_list.count LOOP
    -- list_fields := list_fields || '||content.'||arr_list(k)||'||'||'''~cs~'''; )
    AS
    sql_stmt varchar (30000);
    BEGIN
                   sql_stmt :=
    'DECLARE
         counter NUMBER:=0;     
    auxcontent VARCHAR2(30000);     
         CURSOR content_cursor IS '|| query_sql ||';
         content content_cursor%rowtype;     
         Begin
              open content_cursor;
              loop
                   fetch content_cursor into content;
                   exit when content_cursor%notfound;
                   begin                              
                        auxcontent := auxcontent || '||list_fields||';                    
                   end;
                   counter:=counter+1;     
              end loop;
              close content_cursor;
              htp.prn(auxcontent);
         END;';
    EXECUTE IMMEDIATE sql_stmt;
    END;
    -------------------------------------------------CODE-----------------------------------
    I'm attepting to use DBMS_SQL to perform similar instructions.
    Is it possible?

    Hi Pedro
    You need to use DBMS_SQL here because you don't know how many columns your query is going to have before runtime. There are functions in DBMS_SQL to get information about the columns in your query - all this does is get the name.
    SQL&gt; CREATE OR REPLACE PROCEDURE get_query_cols(query_in IN VARCHAR2) AS
    2 cur PLS_INTEGER;
    3 numcols NUMBER;
    4 col_desc_table dbms_sql.desc_tab;
    5 BEGIN
    6 cur := dbms_sql.open_cursor;
    7 dbms_sql.parse(cur
    8 ,query_in
    9 ,dbms_sql.native);
    10 dbms_sql.describe_columns(cur
    11 ,numcols
    12 ,col_desc_table);
    13 FOR ix IN col_desc_table.FIRST .. col_desc_table.LAST LOOP
    14 dbms_output.put_line('Column ' || ix || ' is ' ||
    15 col_desc_table(ix).col_name);
    16 END LOOP;
    17 dbms_sql.close_cursor(cur);
    18 END;
    19 /
    Procedure created.
    SQL&gt; exec get_query_cols('SELECT * FROM DUAL');
    Column 1 is DUMMY
    PL/SQL procedure successfully completed.
    SQL&gt; exec get_query_cols('SELECT table_name, num_rows FROM user_tables');
    Column 1 is TABLE_NAME
    Column 2 is NUM_ROWS
    PL/SQL procedure successfully completed.
    SQL&gt; exec get_query_cols('SELECT column_name, data_type, low_value, high_value FROM user_tab_cols');
    Column 1 is COLUMN_NAME
    Column 2 is DATA_TYPE
    Column 3 is LOW_VALUE
    Column 4 is HIGH_VALUE
    PL/SQL procedure successfully completed.I've just written this as a procedure that prints out the column names using dbms_output - I guess you're going to do something different with the result - maybe returning a collection, which you'll then parse through in Apex and print the output on the screen - this is just to illustrate the use of dbms_sql.
    best regards
    Andrew
    UK

  • How do i change column names in oracle model?

    Hi,
    I am performing a migration from SQL SERVER 7.0 to Oracle 8.1.7.
    I have tables that have tables in SQL SERVER with column names
    that are "TYPE" and "BODY".(These are generally TEXT datatype
    columns that need to be converted to LONG in Oracle.We need
    these to be LONG datatype in Oracle because of an application we
    are using. LOBS cannot be allowed)
    The migration utility renames these columns as "TYPE_"
    and "BODY_" and creates the tables in the Oracle Database.
    I need to have these tables in Oracle with the same column names
    viz. "TYPE" and "BODY" .
    I can create new tables in Oracle with the column names "TYPE"
    and "BODY" but cannot change the options in the migration
    workbench for this.
    Is there any option or any workaround I can use to change the
    column names in the Oracle model?or set the options so that the
    Oracle model tables donot modify these column names?
    Thanks in advance for all the help.
    Mandar

    The words 'TYPE' and 'BODY' are reserved Oracle words. Its best
    to go along with what the workbench has suggested. If you have
    to keep the original names of the columns trying wrapping double
    quotes around them after the data migration is complete. This
    may cause a case sensitivity or referential problem later on
    though.

  • How to get the column name and table name with value

    Hi All
    I have one difficult requirement
    I have some column values and they have given some alias column names but i need to find the correct column name and table name from the database.
    For example value is "SRI" and i dont know the table and exact column name so is there any possibilities to find the column name and table name for the given value
    Thanks & Regards
    Srikkanth.M

    Searching all the database for a word...
    Courtesy of michaels...
    michaels>  var val varchar2(5)
    michaels>  exec :val := 'as'
    PL/SQL procedure successfully completed.
    michaels>  select distinct substr (:val, 1, 11) "Searchword",
                    substr (table_name, 1, 14) "Table",
                    substr (t.column_value.getstringval (), 1, 50) "Column/Value"
               from cols,
                    table
                       (xmlsequence
                           (dbms_xmlgen.getxmltype ('select ' || column_name
                                                    || ' from ' || table_name
                                                    || ' where upper('
                                                    || column_name
                                                    || ') like upper(''%' || :val
                                                    || '%'')'
                                                   ).extract ('ROWSET/ROW/*')
                       ) t
    --        where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
           order by "Table"or
    11g upwards
    SQL> select table_name,
           column_name,
           :search_string search_string,
           result
      from (select column_name,
                   table_name,
                   'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
              from cols
             where table_name in ('EMP', 'DEPT')),
           xmltable (str columns result varchar2(10) path '.')
    TABLE_NAME                     COLUMN_NAME                    SEARCH_STRING                    RESULT   
    DEPT                           DNAME                          es                               RESEARCH 
    EMP                            ENAME                          es                               JAMES    
    EMP                            JOB                            es                               SALESMAN 
    EMP                            JOB                            es                               SALESMAN 
    4 rows selected.

  • How to find the column name and table name with a value

    Hi All
    How to find the column name and table name with "Value".
    For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
    Any help is highly appricatable
    Thanks & Regards
    Srikkanth.M

    2 solutions by Michaels (the latter is 11g upwards only)...
    michaels>  var val varchar2(5)
    michaels>  exec :val := 'as'
    PL/SQL procedure successfully completed.
    michaels>  select distinct substr (:val, 1, 11) "Searchword",
                    substr (table_name, 1, 14) "Table",
                    substr (t.column_value.getstringval (), 1, 50) "Column/Value"
               from cols,
                    table
                       (xmlsequence
                           (dbms_xmlgen.getxmltype ('select ' || column_name
                                                    || ' from ' || table_name
                                                    || ' where upper('
                                                    || column_name
                                                    || ') like upper(''%' || :val
                                                    || '%'')'
                                                   ).extract ('ROWSET/ROW/*')
                       ) t
    --        where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
           order by "Table"or
    SQL> select table_name,
           column_name,
           :search_string search_string,
           result
      from cols,
           xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
           columns result varchar2(10) path '.'
    where table_name in ('EMP', 'DEPT')
    TABLE_NAME           COLUMN_NAME          SEARCH_STRING        RESULT   
    DEPT                 DNAME                ES                   RESEARCH 
    DEPT                 DNAME                ES                   SALES    
    EMP                  ENAME                ES                   JONES    
    EMP                  ENAME                ES                   JAMES    
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   PRESIDENT
    EMP                  JOB                  ES                   SALESMAN 
    9 rows selected.

  • If variable name is the same as the column name in procedure ?

    If variable name is the same as the column name in procedure , What should i do?
    For Example :
    CREATE OR REPLACE PROCEDURE "TEST_PROC" (MIN_SALARY in UMBER)
    as
    begin
    INSERT INTO TEST SELECT JOB_ID,MIN_SALARY FROM JOBS WHERE MIN_SALARY = MIN_SALARY;
    end;

    You could follow a better naming convention and have the parameters to the procedures named in a way so as not to be confused with column names.
    You could prefix the variable names with the name of the procedure they appear in but then what if your have procedure names same as table names?
    SQL> create or replace procedure test_proc(sal in number) is
      2    cnt number ;
      3  begin
      4    select count(*) into cnt from scott.emp where scott.emp.sal = test_proc.sal ;
      5    dbms_output.put_line('cnt='||cnt) ;
      6  end ;
      7  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec test_proc(800) ;
    cnt=1
    PL/SQL procedure successfully completed.
    SQL>If you search you can find several posts here itself on naming convention to avoid such issues in first place.

  • Using dynamic column name in datagrid selectedItems

    Hi
    I have a datagrid loaded with 2 columns. Allowmultiselect is turned on.
    Based on the values selected at run time, I get the corresponding selected column name and its values and shown it on HTML screen.
    // grp is datagrid
    // dgrcl is a data grid column
    // selflds is an array which has 0,1,2,3 values
    //selflds[0] = name,selflds[1]=age
    for (var l:int=0; l<grp.columnCount; l++)
    dgrcl =grp.columns[l];
    selflds[l] = dgrcl.dataField;
    // srhVals will have only one selected value at any point
    // getting the corresponding selected column name and its value
    var  srhVals:String;
    srhVals = String(grp.selectedItem[selflds[1]]);
    I am trying to achieve the above selection instead by .selectedItems somthing like this below. By doing like this, I will get all the selected items but not only one. If i try below syntax, i get error. Any one has ideas on how to do.
    srhVals = String(grp.selectedItems.selflds[1]);

    Hi
    I got my mistake, there should be no dot operator after selectedItems;
    I got a solution - it goes like this:
    for(var g:int=0;g<grp.selectedItems.length;g++)
    srhVals = srhVals + String(grp.selectedItems[g][selflds[1]]);
    So the complete scenario is like this:
    Datagrid:
    Name      Age    
    a               20
    b               30
    c               40
    d               50
    I am selecting b,d in UI. At run time, I get programatically the selecteditem column name as "Name", loop through the selecteditems and store the value in srhVals as b,d.
    b,d will be finally shown in UI.

  • 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>

Maybe you are looking for

  • Export to text and chr(13)||chr(10)

    Hi All, I have report (10g) and one column that formatted by PL/SQL to have multiply rows in it. This achieved by adding chr(13)||chr(10) to the row, so I have multiply rows result on report output. But when the same report is exported to text file,

  • I can't load Family pack of original iWork on a new iMac. I've only used 3 of 5 computers. It keeps telling me to go buy it. What's going on?

    I have a 2007 iMac with the original version of iWork. I purchased a family pak (5 computers) and have only used 3. My wife just got her first Mac. When I put the disc in, I am unable to load it without being directed to purchase it again. I know it'

  • Delete all call logs

    I can't find a way to delete all call logs. It only allows to delete logs for one call at a time. In SMS it allows highlighting of all messages (which is quite painful BTW) and then delete. Not so in call logs. Seems arcane that BB does not have a me

  • ISight use

    Will a FireWire 800 to 400 adaptor get my iSight to work on a new Mini? Is there a USB3 adaptor that would work?

  • Tax Not Calculating Correctly

    Hi experts. I have noticed that sometimes, on some lines on a sales order, the tax is incorrect. For example the line total is 17.96 the tax at 20% should be 3.59 (3.592) but SAP makes it 3.60 This happens on most orders all the other lines are corre