Can we use Column Names in Parameter Cursor

Hi
can we use Column Names in Parameter Cursor??
DECLARE
CURSOR Emp_Cur (P_Deptno NUMBER)
IS
SELECT Empno, Ename
FROM Emp
WHERE Deptno = P_Deptno;
BEGIN
FOR Emp IN Emp_Cur(10)
LOOP
DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
END LOOP;
FOR Emp IN Emp_Cur(20)
LOOP
DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
END LOOP;
END;
In the above Program, I send Deptnumber. If i send Column names like Empno, Ename. What can i do??
If Declare Samething Through Parameter Cursor, it doesn't accept VARCHAR2(Size)

For parameters you don't use size, just the type (DATE, NUMBER, VARCHAR2, CLOB, ...)
DECLARE
  CURSOR Emp_Cur (P_Ename VARCHAR2)
  IS
    SELECT Empno, Ename
    FROM Emp
    WHERE Ename = P_Ename;
BEGIN
  FOR Emp IN Emp_Cur('SCOTT')
  LOOP
    DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
    DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
  END LOOP;
END;

Similar Messages

  • Column name of a cursor

    How can I get the column name of a cursor?

    I want to catch the column name of a cursor dynamically.
    declare
    cursor xx is select * from yy;
    begin
    for i in xx
    loop
    my requirement is as below
    message(xx.columnName(i));
    end loop;
    end;

  • Irc account keeps disconnecting cannot use IM what is nick at the beginning of the name ..can i use another name ? thank you

    hello i am trying to set up instant messaging ....the account keeeps disconnecting after a few seconds and i cannot make it work
    it keeps saying nick ... what is nick at the beginning of the name ..can i use another name ?
    if i use mozilla for IRC what is the server name ?
    what other details do i need to type in ?
    Thunderbird is running on a single home PC which only has Open Suse 13.1 x64 linux on it ( no Windows )
    thank you

    'nick' is your nickname which you entered when you set up the IRC chat. You can register your nickname by entering "/msg nickserv register <password> <email address>"
    Then when you start next time enter "/msg nickserv identify <password>"
    You can get a list of nickserv commands by entering "/msg nickserv help"

  • CAN I USE GROUP BY SCRIPT AT CURSOR.?

    I USE GROUP BY SCRIPT AT CURSOR, SO THAT CURSOR DOESN'T WORK.
    CAN I USE GROUP BY SCRIPT AT CURSOR.?
    THANK YOU !! HAVE A NICE DAY ^^
    Message was edited by:
    악어조심

    Thank you Francois ^^
    I will use that query program unit at form builder
    Forms [32 Bit] Version 6.0.8.11.3 (Production)
    Oracle Toolkit Version 6.0.5.35.0 (Production)
    PL/SQL Version 8.0.6.0.0 (Production)
    Oracle Procedure Builder V6.0.8.11.0 Build #449 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 6.0.7.0.0 - Production
    Oracle Virtual Graphics System Version 6.0.5.35.0 (Production)
    Oracle Tools GUI Utilities Version 6.0.5.35.0 (Production)
    Oracle Multimedia Version 6.0.5.34.0 (Production)
    Oracle Tools Integration Version 6.0.8.10.2 (Production)
    Oracle Tools Common Area Version 6.0.5.32.1
    Oracle CORE Version 4.0.6.0.0 - Production
    Message was edited by:
    악어조심

  • Can I use user names and password of Microsoft Office Outlook for hyperion

    I'm new to Hyperion. Can anyone tell that can I use "user names" and "passwords" of Microsoft Office Outlook for login into hyperion applications.
    I'm not talking about single sign on, but want to use same user names and passwords as that in Outlook.
    ANy suggestions?

    That depends on how your Outlook authentication is configured.
    Hyperion is generally configured to authenticate against a network directory (NTLM, MSAD or LDAP). I'm not an Outlook expert, but my Outlook user ID and password is almost always my MSAD id and password (I change clients regularly, and it's almost always the same situation). So it's also usually the same as my Hyperion ID and password.
    Ask your Outlook administrator whether it uses (or syncs with) MSAD, NTLM or LDAP. If the answer is yes, then you're in good shape because Hyperion can use these as well.
    Hope this helps,
    - Jake

  • Unity Express Backup: Can we use DNS name of FTP server instead of IP address?

    Gentlemen!
    In the Unity Express system, can we use DNS name of FTP server (Microsoft FTP Server) instead of IP address in the General configuartion for Backup Server?
    e.g.  FTP://FTP_Server_Name/Directory
    Additionally we need to configure/add DNS server name in the Domain Name settings under system menu. Is there any additional configuration would require for setting up FTP server with DNS entry & above config?
    Regards,
    Sky_Voice

    Hi Sky_Voice,
    This is a supported config
    Backing Up and Restoring Data
    Last Updated: May 12, 2010
    Cisco Unity Express backup and restore functions use an FTP server to store and retrieve data. The backup function copies the files from the Cisco Unity Express application to the FTP server and the restore function copies the files from the FTP server to the Cisco Unity Express application. The FTP server can reside anywhere in the network if the backup and restore functions can access it with an IP address or hostname.
    We recommend that backups be done regularly to preserve voice-mail messages and configuration data.
    Backup and restore commands are available in configuration mode and in offline mode.
    •In configuration mode, commands are available to set the following parameters:
    –Number of backup files to keep (the oldest file is deleted).
    –URL of the FTP server where the files will be stored.
    •In offline mode, perform the backup or restore procedure. Decide the following:
    –Type of files to be backed up: all files (configuration and data), only configuration files, or only data files. Data files consist of voice-mail messages. Configuration files consist of all other system and application parameters.
    –URL of the FTP server where the files will be stored.
    http://www.cisco.com/en/US/docs/voice_ip_comm/unity_exp/rel3_2/administrator/voicemail/11bkrst_ps5520_TSD_Products_Administration_Guide_Chapter.html
    Cheers!
    Rob

  • How can i replace column name using reciever JDBC adapter on runtime.

    Hi Experts,
    I have a problem with reciever JDBC synario.
    Target Oracle table has columns named 2 bytes Japanese character like "日本".
    Datatype cannot accept 2bytes character as element name.
    So, I would like to how to replace column name on runtime.
    Please tell me.
    Regards,
    Shinya Kawaoge

    Hi Shinya Kawagoe,
    I understand there is a column with two Japanese characters in target database table. Now you want to UPDATE or INSERT data in that table. You do not want to rename the column name in the database table (if you want to rename column, ask the target database admin ).
    As Japanese characters are not allowed in XML Data Type in ESR. You can [Define a SQL_QUERY Statement|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b7855fde93673e10000000a114a6b/frameset.htm]. Check the Addres日本s in below code.
    <root>
      <stmt>
        <Customers action="SQL_DML">
          <access> UPDATE Customers SET CompanyName=u2019$NAME$u2019, Addresu65E5u672Cs=u2019$ADDRESS$' WHERE CustomerID='$KEYFIELD$u2019
          </access>
          <key>
            <NAME>Firma</NAME>
            <ADDRESS>Strasse 3 </ADDRESS>
            <KEYFIELD>FI</KEYFIELD>
          </key>
        </Customers>
      </stmt>
    </root>
    Regards,
    Raghu_Vamsee

  • Re: Column Name as Parameter in Oracle Procedure

    Hi,
    I've successfully compiled the following procedure:
    CREATE OR REPLACE PROCEDURE CREATE_MEASURES_IND_RPT(
        pSTART_DT                                    IN date
    ,   pEND_DT                                         IN date  
    ,   PGEO_DIMENSION_COLUMN               IN VARCHAR2
    AUTHID CURRENT_USER IS
    BEGIN
    DECLARE
        START_DT Date      := pSTART_DT;
        END_DT     Date      := pEND_DT;
    text_ip_adjusted varchar2(10000):='
      select
        replace(fiscal_yr,''/'') as fiscal_year,
        NVL(f_quarter(is_date(disdate,''yyyymmdd'')),''Year'') AS TIME_PERIOD_TYPE,
        NVL('||PGEO_DIMENSION_COLUMN||',''Province'') as geo_desc
        from data_table A,
                postal_code_table B
        where POSTCODE = B.POSTALCODE
          AND (is_date(disdate,''yyyymmdd'') >= :1 and is_date(disdate,''yyyymmdd'') < :2)
        GROUP BY
        replace(fiscal_yr,''/''),
        ROLLUP(f_quarter(is_date(disdate,''yyyymmdd''))),
        ROLLUP('||PGEO_DIMENSION_COLUMN||');
    begin
    EXECUTE IMMEDIATE text_ip_adjusted using START_DT,END_DT; COMMIT;
    END;
    END CREATE_MEASURES_IND_RPT;
    /When I try and execute the procedure, I get the following error:
    ORA-00936: missing expression
    ORA-06512: at "CREATE_MEASURES_IND_RPT", line 36
    ORA-06512: at line 1The data table has date strings which need to be converted to dates using an "IS_DATE" function I've created which is while you'll see the is_date function used. The procedure works fine when I don't include the PGEO_DIMENSION_COLUMN as a parameter so I suspect that I haven't reference the name of the column properly. Essentially, I need my procedure to be able to specify a Column Name in the Postal Code table to use as a group by field.
    Any help would be appreciated.
    Thanks,
    Ed

    Hi,
    spalato76 wrote:
    Hi,
    I've successfully compiled the following procedure:
    CREATE OR REPLACE PROCEDURE CREATE_MEASURES_IND_RPT(
    pSTART_DT                                    IN date
    ,   pEND_DT                                         IN date  
    ,   PGEO_DIMENSION_COLUMN               IN VARCHAR2
    AUTHID CURRENT_USER IS
    BEGIN
    DECLARE
    START_DT Date      := pSTART_DT;
    END_DT     Date      := pEND_DT;
    text_ip_adjusted varchar2(10000):='
    select
    replace(fiscal_yr,''/'') as fiscal_year,
    NVL(f_quarter(is_date(disdate,''yyyymmdd'')),''Year'') AS TIME_PERIOD_TYPE,
    NVL('||PGEO_DIMENSION_COLUMN||',''Province'') as geo_desc
    from data_table A,
    postal_code_table B
    where POSTCODE = B.POSTALCODE
    AND (is_date(disdate,''yyyymmdd'') >= :1 and is_date(disdate,''yyyymmdd'') < :2)
    GROUP BY
    replace(fiscal_yr,''/''),
    ROLLUP(f_quarter(is_date(disdate,''yyyymmdd''))),
    ROLLUP('||PGEO_DIMENSION_COLUMN||');
    begin
    EXECUTE IMMEDIATE text_ip_adjusted using START_DT,END_DT; COMMIT;
    END;
    END CREATE_MEASURES_IND_RPT;
    /When I try and execute the procedure, I get the following error:
    ORA-00936: missing expression
    ORA-06512: at "CREATE_MEASURES_IND_RPT", line 36
    ORA-06512: at line 1The data table has date strings which need to be converted to dates using an "IS_DATE" function I've created which is while you'll see the is_date function used. The procedure works fine when I don't include the PGEO_DIMENSION_COLUMN as a parameter so I suspect that I haven't reference the name of the column properly. Essentially, I need my procedure to be able to specify a Column Name in the Postal Code table to use as a group by field.
    Any help would be appreciated.
    Thanks,
    EdIt l;ooks like you're missing a single-quote at the very end of the expression being assigned to text_ip_adjusted.
    ...       ROLLUP(' || PGEO_DIMENSION_COLUMN || ')';How will you handle the output from that dynamic query? Maybe you should be opening a cursor.

  • Dynamic Column name in a Cursor

    Hello there,
    How can I access data in cursor's field with dynamic fields names, more illustration follows:
    My table has columns named as C1,C2,C3 so on
    defined a cursor cursor_name on that table,
    I need to access the fields by a loop like this:
    OPEN cursor_name;
    Fetch cursor_name into rec;
    for i in 1 .. 10 loop
    if rec.ci = 1Then
    end if;
    end loop
    close cursor_name;
    where rec,ci represents the name of the cursor fields, so that I loop over them,
    how can I implement such an idea,
    thanks in advance
    regards

    Thanks Bily, and user10715047,
    actually the reason behind the need of such an approach, is as following:
    assume that I have table of set of logical conditions, " LOGICAL CONDITIONS" has three columns: ID, Condition_name and the logical_condition, example:
    1, c1,  x = 1
    5, c2,  y = 2
    10, c3, p = 3 where ID is just a sequence to identify the records from each other "primary key"
    assume that I need to provide the possible combination of the result of applying each of the conditions, for example :
    if c1 = 1 ,c2= 0 and c3= 1 then  my result must be 1 ' This according some predefined rulesso that I created table which contains all the possible logical conditions, ( as the max number of logical conditions are known)
    defined as follows : combination( combination_ID, c1, c2, c3, c4, ....cmax, result)
    sample record:
    combination_ID, c1,  c2, c3, .. c max, result
              100,   1,    0,   1, ....., 1, 1in the PL/SQL procedure, I would get all the needed combination, into a cursor, then to optimized the code, I need to access the fields ( which is the Ci) in a loop
    for i in 1..3 loop
    if cursor_rec.ci = 1 then
    Action
    end if;
    end loop;the dynamic name I meant in my first post was this : cursor_rec.ci ,
    so that I can access the cursor's fields without the need to name them one by one, as there could be long sequence of conditions to be checked.
    hope that I made the idea clearer, Any suggestions, please !
    anyway I will give the DBMS_SQL cursors a shot , try if I can use to implement the purpose,
    as I know similar dynamical variable names, is available in Java,
    Regards,

  • Using Column Name in a Second Table

    I have two tables in a sheet, Data and Report. Data contains a column named Hours. How can I write a sum function in the Report table that sums the values in the Hours column in Data? I'd like to use a named reference instead of a row/column letter/number range for when the Hours column gets longer.

    David Benman1 wrote:
    Thanks. I tried what you said, but initially it didn't work. I realized I needed to make the top row a header row, but that leads to a new question. All my columns now can be reference by name except the first column. Is there anything special I need to do to the first column? If the first column is "Hours", then when I type in "Hours" in my formula, the spreadsheet doesn't recognize it as a column name.
    Yes, you must read the User Guide which explains :
    Yvan KOENIG (VALLAURIS, France) 2 septembre 2010 12:06:03

  • How to use column name as variable in select statement

    hi,
    i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
    select :m1 from table1;
    regards

    Hi,
    Is this what you want..
    SQL> select &m1 from dept;
    Enter value for m1: deptno
    old   1: select &m1 from dept
    new   1: select deptno from dept
        DEPTNO
            10
            20
            30
            40
    SQL> select &m1 from dept;
    Enter value for m1: dname
    old   1: select &m1 from dept
    new   1: select dname from dept
    DNAME
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONS
    SQL> select &&m1 from dept;
    Enter value for m1: loc
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTON
    SQL> select &&m1 from dept;
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
    But if you will use double '&&' the value of m1 will be persistent across the session..
    Twinkle

  • JTable can't display column names and scroll bar in JDialog !!

    Dear All ,
    My flow of program is JFrame call JDialog.
    dialogCopy = new dialogCopyBay(frame, "Bay Name Define", true, Integer.parseInt(txtSourceBay.getText()) ,proVsl ,300 ,300);
    dialogCopy.setBounds(0, 0, 300, 300);
    dialogCopy.setVisible(true);        Then,I set the datasource of JTable is from a TableModel.
    It's wild that JTable can diplay the data without column names and scroll bar.
    I have no idea what's going wrong.Cause I follow the Sun Tutorial to code.
    Here with the code of my JDialog.
    Thanks & Best Regards
    package com.whl.panel;
    import com.whl.vslEditor.vslDefine;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Frame;
    import javax.swing.JDialog;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    public class dialogCopyBay extends JDialog {
        vslDefine glbVslDefine;
        int lvCnt = -1;
        JTable tableCopyBay;
        int bgnX = 0;
        int bgnY = 30;
        int tableWidth = 100;
        int tableHeight = 100;
        public dialogCopyBay(Frame frame, String title, boolean modal, int sourceBay,
                vslDefine pVslDefine, int ttlWidth, int ttlHeight) {
            super(frame, title, true);
            Container contentPane = getContentPane();
            System.out.println("dialogCopyBay Constructor");
            glbVslDefine = null;
            glbVslDefine = pVslDefine;
            copyBayModel copyBay = new copyBayModel((glbVslDefine.getVslBayStructure().length - 1),sourceBay);
            tableCopyBay = new JTable(copyBay);
            tableCopyBay.setPreferredScrollableViewportSize(new Dimension(tableWidth, tableHeight));
            JScrollPane scrollPane = new JScrollPane(tableCopyBay);
            scrollPane.setViewportView(tableCopyBay) ;
            tableCopyBay.setFillsViewportHeight(true);
            tableCopyBay.setBounds(bgnX, bgnY, tableWidth, tableHeight);
            tableCopyBay.setBounds(10, 10, 100, 200) ;
            contentPane.setLayout(null);
            contentPane.add(scrollPane);
            contentPane.add(tableCopyBay);
        class copyBayModel extends AbstractTableModel {
            String[] columnNames;
            Object[][] dataTarget;
            public copyBayModel(int rowNum ,int pSourceBay) {
                columnNames = new String[]{"Choose", "Bay Name"};
                dataTarget = new Object[rowNum][2];
                for (int i = 0; i <= glbVslDefine.getVslBayStructure().length - 1; i++) {
                    if (pSourceBay != glbVslDefine.getVslBayStructure().getBayName() &&
    glbVslDefine.getVslBayStructure()[i].getIsSuperStructure() == 'N') {
    lvCnt = lvCnt + 1;
    dataTarget[lvCnt][0] = false;
    dataTarget[lvCnt][1] = glbVslDefine.getVslBayStructure()[i].getBayName();
    System.out.println("lvCnt=" + lvCnt + ",BayName=" + glbVslDefine.getVslBayStructure()[i].getBayName());
    public int getRowCount() {
    return dataTarget.length;
    public int getColumnCount() {
    return columnNames.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int rowIndex, int columnIndex) {
    return dataTarget[rowIndex][columnIndex];
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    public boolean isCellEditable(int row, int col) {
    if (col == 1) {
    // Bay Name Not Allow To modify
    return false;
    } else {
    return true;
    public void setValueAt(Object value, int row, int col) {
    dataTarget[row][col] = value;
    fireTableCellUpdated(row, col);

    Dear DB ,
    I am not sure what you mean.
    Currently,I don't undestand which code is error.
    And I also saw some example is add JTable and JScrollPane in JDialog.
    Like Below examle in Sun tutorial
    public class ListDialog extends JDialog implements MouseListener, MouseMotionListener{
        private static ListDialog dialog;
        private static String value = "";
        private JList list;
        public static void initialize(Component comp,
                String[] possibleValues,
                String title,
                String labelText) {
            Frame frame = JOptionPane.getFrameForComponent(comp);
            dialog = new ListDialog(frame, possibleValues,
                    title, labelText);
         * Show the initialized dialog. The first argument should
         * be null if you want the dialog to come up in the center
         * of the screen. Otherwise, the argument should be the
         * component on top of which the dialog should appear.
        public static String showDialog(Component comp, String initialValue) {
            if (dialog != null) {
                dialog.setValue(initialValue);
                dialog.setLocationRelativeTo(comp);
                dialog.setVisible(true);
            } else {
                System.err.println("ListDialog requires you to call initialize " + "before calling showDialog.");
            return value;
        private void setValue(String newValue) {
            value = newValue;
            list.setSelectedValue(value, true);
        private ListDialog(Frame frame, Object[] data, String title,
                String labelText) {
            super(frame, title, true);
    //buttons
            JButton cancelButton = new JButton("Cancel");
            final JButton setButton = new JButton("Set");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    ListDialog.dialog.setVisible(false);
            setButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    ListDialog.value = (String) (list.getSelectedValue());
                    ListDialog.dialog.setVisible(false);
            getRootPane().setDefaultButton(setButton);
    //main part of the dialog
            list = new JList(data);
            list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            list.addMouseListener(new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2) {
                        setButton.doClick();
            JScrollPane listScroller = new JScrollPane(list);
            listScroller.setPreferredSize(new Dimension(250, 80));
    //XXX: Must do the following, too, or else the scroller thinks
    //XXX: it's taller than it is:
            listScroller.setMinimumSize(new Dimension(250, 80));
            listScroller.setAlignmentX(LEFT_ALIGNMENT);
    //Create a container so that we can add a title around
    //the scroll pane. Can't add a title directly to the
    //scroll pane because its background would be white.
    //Lay out the label and scroll pane from top to button.
            JPanel listPane = new JPanel();
            listPane.setLayout(new BoxLayout(listPane, BoxLayout.Y_AXIS));
            JLabel label = new JLabel(labelText);
            label.setLabelFor(list);
            listPane.add(label);
            listPane.add(Box.createRigidArea(new Dimension(0, 5)));
            listPane.add(listScroller);
            listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    //Lay out the buttons from left to right.
            JPanel buttonPane = new JPanel();
            buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
            buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
            buttonPane.add(Box.createHorizontalGlue());
            buttonPane.add(cancelButton);
            buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
            buttonPane.add(setButton);
    //Put everything together, using the content pane's BorderLayout.
            Container contentPane = getContentPane();
            contentPane.add(listPane, BorderLayout.CENTER);
            contentPane.add(buttonPane, BorderLayout.SOUTH);
            pack();
        public void mouseClicked(MouseEvent e) {
            System.out.println("Mouse Click");
        public void mousePressed(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        public void mouseReleased(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        public void mouseEntered(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        public void mouseExited(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        public void mouseDragged(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        public void mouseMoved(MouseEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
         * This is here so that you can view ListDialog even if you
         * haven't written the code to include it in a program.
    }

  • Using Column Name returned by function in SELECT statement

    Hi
    Output from my function (RETURN data type is VARCHAR2) is column name. I want to use it directly in my SELECT statement. Below is simplified example of this:
    --- Function
    CREATE OR REPLACE FUNCTION simple RETURN varchar2 IS
    BEGIN
    RETURN ‘my_column’;
    END simple;
    --- Select
    SELECT simple FROM my_table;
    This does not work. It seems that output from function is passed in quotation i.e.
    SELECT ‘my_column’ FROM my_table;
    So the output from SELECT is a list of rows populated with values my_table:
    COLUMN     simple
    ROW1     my_column
    ROW2     my_column
    ROW3     my_column
    Can please someone help me with this?

    I'm not sure I got you right.
    In standard SQL everything must be known at compile time. If not dynamic SQL is required, but is a costly operation (usually requires parsing before each execution) so it should better not be used when standard SQL can do it.
    I provided a design time example where a function returns the column name from the given the table name and column id for a varchar2 column data type to make things simple. Then a query string is constructed and executed dynymically to return all column values of the chosen table_name.column_name.
    SELECT simple FROM my_tableAt compile time the simple function return value is unknown (any varchar2 value would do) you already find out you get the (same) return value (i.e column name) for each table row => dynamic SQL needed to get the column values
    The purpose of function would be to rename all columns for provided table.The table name would be provided, right? If yes => dynamic SQL
    What is the function supposed to return the column name (where would the new name come from?), the column alias (which table column would be renamed to the new name?)
    The user could use the new_column name as the column alias name submitting the query.
    Is it possible to do this?Maybe () using a pipelined function (different data types - number,date, ... not cosidered yet) but your simple query;
    <tt>SELECT simple FROM my_table</tt>
    might look like:
    <tt>select my_column_value new_column_name from table(get_column_value(table_name,column_name))</tt>
    Sorry, no Database at hand to provide a specific example.
    Regards
    Etbin

  • Using column names dynamically in Trigger

    Hello Everyone,
    I want to use a trigger for my application in which column names will be provided dynamically rather than hard coded. i.e. for ex. I want to have foll. code
    Execute Immediate
    'Begin
    dbms_output.put_line'' ' &#0124; &#0124; :new.col_name &#0124; &#0124; ' ''); End; ';
    where in ":new.col_name" col_name will be replaced dynamically. so if any of you can tell me how to achive this I will be thankful to you. Hoping for the best.
    Regards
    -Heena

    My advise will be to think about using dynamic PL/SQL.

  • How can I use variable name as a prameter value in HOST Command ???

    Hi All,
    How can it possible to use variable value in parameter in HOST command ??
    Following in my code:
    host('rwclient server=reptest report=c:\cust_print.rdf p_1= s_sam_cust_id userid=wh1/wh1@dwh desformat=pdf desty=file desname=c:/temp/'||v_sam_cust_id||'.pdf');
    Regards

    Hello,
    The Syntax of the builtin HOST is :
    SyntaxPROCEDURE HOST
    (system_command_string VARCHAR2);
    PROCEDURE HOST
    (system_command_string VARCHAR2,
    screen_action NUMBER);
    So , you can build the system_command_string as any VARCHAR2
    Example are provided in online help :
    http://www.oracle.com/webapps/online-help/forms/10g/topics/f1_help/builth_m/host.html?tp=true
    Regards

Maybe you are looking for