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.
}

Similar Messages

  • I'D LIKE TO VIEW MY SAFARI WHERE I CAN STILL DISPLAY MY DOCK AND MENU BAR....HOW DO I DO THIS...DO NOT WANT FULL SCREEN

    I'D LIKE TO VIEW SAFARI WHERE I CAN STILL DISPLAY MY DOCK AND MENU BAR...DO NOT WANT FULL SCREEN.  HOW DO I DO THIS?

    You can also go up to "View," and look all the way down to "Exit Full Screen."
    Command+Control+f will toggle it off and on.

  • JTable column movement and scroll bar

    Hello:
    I have a JTable with about 30-40 columns. Sometimes I would like to drag the column from rightmost to closer to the left end. I am not able to do that in one shot. and instead have to do it in multiple steps. Is there a way for the scroll bar to sort of move alongside the column as I drag it along?

    i dont know if there is way off hand. But you can put your own mouseListener of the JScrollPane and i am sure there is some method to check if you are dragging the JTable and if you are move the JScrollBar in the direction.
    I think that you are going to have to make you own implementation of this.
    David

  • Generating CSV file with column names and data from the MySQL with JAVA

    Hi all,
    Give small example on ...
    How can I add column names and data to a CSV from from MySQL.
    like
    example
    sequence_no, time_date, col_name, col_name
    123, 27-apr-2004, data, data
    234, 27-apr-2004, data, data
    Pls give small exeample on this.
    Thanks & Regards
    Rama Krishna

    Hello Rama Krishna,
    Check this code:
    Example below exports data from MySQL Select query to CSV file.
    testtable structure
    CREATE TABLE testtable
    (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    text varchar(45) NOT NULL,
    price integer not null);
    Application takes path of output file as an argument.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class automateExport {
        public static void main(String[] args) {
            DBase db = new DBase();
            Connection conn = db.connect(
                    "jdbc:mysql://localhost:3306/test","root","caspian");
            if (args.length != 1) {
                System.out.println(
                        "Usage: java automateExport [outputfile path] ");
                return;
            db.exportData(conn,args[0]);
    class DBase {
        public DBase() {
        public Connection connect(String db_connect_str,
                String db_userid, String db_password) {
            Connection conn;
            try {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                conn = DriverManager.getConnection(db_connect_str,
                        db_userid, db_password);
            } catch(Exception e) {
                e.printStackTrace();
                conn = null;
            return conn;
        public void exportData(Connection conn,String filename) {
            Statement stmt;
            String query;
            try {
                stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                //For comma separated file
                query = "SELECT id,text,price into OUTFILE  '"+filename+
                        "' FIELDS TERMINATED BY ',' FROM testtable t";
                stmt.executeQuery(query);
            } catch(Exception e) {
                e.printStackTrace();
                stmt = null;
    Greetings,
    Praveen Gudapati

  • Jtable need help with column name

    hi, i'm currently working on a project where my jtable grab data from the database.
    as for the where clause i am thinking if i can get the column name as the field name in the table. However, I would like to hide the field name from the user.
    So, I'm here to kindly ask if there is a way that i can display the column name that is hidden from the field name.
    thanks in advance.

    actually, I am thinking of a lazy way to add the 'where' clause for my sql statement.
    so, instead of detecting which column that is related to the field i can just use the columns header name as my field. But on the other hand, I'd like to hide my field name from the user .
    For say my field name is "emp_no" but it is displayed as "Employee No" to the user. and when i do my sql statement i can do something like this:
    select * from emp_details where + jtable.getcolumnname(i).tostring() + = jtable.getvalueat(j,i)
    is there a way i can do it so???
    thanks again. and thanks for the reply

  • Reading MS Project column names and data on the fly from a selected View

    Hi guys,
    I have several views on my project file (MSPROJECT 2010) and I want to build a macro so that;
    1. User can select any view ( Views can have diffrent columns and the user may add new columns as well)
    2. User runs the Macro and all the coulmns along with the tasks displayed in the view will be written to a excel file. ( I don't want to build several macro's for each view, I'm thinking of a common method which would work for any selected view)
    The problem I'm facing is that how will i read the column names and data for a particular view on the fly without hard coding them inside the vba code ?
    The solution needs to work on a master schedule as well.
    Appreciate your feedback.

    Just to get you started the following code writes the field name and data for the active task to the Immediate window.
    Sub CopyData()
    Dim fld As TableField
    For Each fld In ActiveProject.TaskTables(ActiveProject.CurrentTable).TableFields
    If fld.Field >= 0 Then
    Debug.Print Application.FieldConstantToFieldName(fld.Field), ActiveCell.Task.GetField(fld.Field)
    End If
    Next fld
    End Sub
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • How to put the column name and variable value in the alert message.

    Dear,
    how can i put the column name and variable value in the alert message text. i want to display an alert which tell the user about the empty textboxes. that these textboxes must be filled.
    Regards:
    Muhammad Nadeem
    CHIMERA PVT. LTD.
    LAHORE
    [email protected]

    Hello,
    The name of the item that fires the current trigger is stored in the :SYSTEM.TRIGGER_ITEM system variable.
    The value contained in this item can be retrived with the Name_In() built-in
    value := Name_In( 'SYSTEM.TRIGGER_ITEM') ;
    LC$Msg := 'The item ' || :SYSTEM.TRIGGER_ITEM || ' must be entered' ;
    Set_Alert_Property('my_alert_box', ALERT_MESSAGE_TEXT, LC$Msg ) ;
    Ok := Show_Alert( 'my_alert_box' ) ;
    ...Francois

  • How to create list of a View's column names and source

    Using SQL 2005, 2008, and 2012
    How to create list of a View's column names and source. For the following example would like to @Print something like the following.  Does anyone already have some code to do this? I realize there are probably some gotchas, but the views that I am looking
    at to use this follows the code snippet pattern below.
    DBACCT.[Account Number]
    dbo.ConvertDate(DBACDT). [Boarding Date]
    DBXES.DBXES
    CREATE VIEW [dbo].[v_ods_DBAL]
    AS
    SELECT DBACCT AS [Account Number], dbo.ConvertDate(DBACDT) AS [Boarding Date], DBXES
    FROM dbo.ods_DBAL

    The column information can be obtained from INFORMATION_SCHEMA.COLUMNS view using logic like below
    SELECT c.COLUMN_NAME,c.DATA_TYPE
    FROM INFORMATION_SCHEMA.COLUMNS c
    WHERE EXISTS (SELECT 1
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_NAME = c.TABLE_NAME
    AND TABLE_TYPE='VIEW')
    http://technet.microsoft.com/en-us/library/ms188348.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Can i see the name and the nickname at the same time

    Can I see the name and the nickname at the same time when Iphone 4 is ringing?
    Sometimes i don't remember somebody's name, so i want to see the name and nickname when phone is ringing.

    i download an app called call informer on my Android phone, it can display nickname, company name at the same time. i don't know if IOS has similar app.

  • What is the key column name and value column name in JDBC Adapter parameter

    Hi
    Can any one please tell me what is the Key Column Name and Key Column Value in JDBC adatper parameters. If i dont mention those parameters i am getting the following error
    <b> Value missing for mandatory configuration attribute tableEOColumnNameId</b>
    Please help me
    Best Regards
    Ravi Shankar B

    Hi
    I am doing DataBase Lookup in XI
    First i have created a  Table in Database( CheckUser) which has two fields UserName and PhoneNumber and then i have created
    I have created one Communication Channel For Reciever Adapter .
    I have given the parameters like this
    JDBC Driver : com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection : jdbc:microsoft:sqlserver://10.7.1.43:1433;DatabaseName=Ravi;
    UserName.... sa
    password.... sa
    persistence : Database
    Database Table Name : CheckUser
    Key column name and Value column name i left blank and activated
    and then
    I have created
    Data Types : Source ...... UserName
                      Destination.... PhoneNumber
    Message Types
    Message Interfaces
    In Message Mapping
                  I have created one User Defined function DBProcessing_SpecialAPI().This method will get the data from the database....
    In this function i have written the following code
       //write your code here
    String query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    query = "select Password from CheckUser where UserName = ' " +UserName[0]+ " '  ";
    try {
         channel = LookupService.getChannel("Ravi","CC_JDBC");
         accessor = LookupService.getDataBaseAccessor(channel);
         resultSet = accessor.execute(query);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){
              Map  rowMap = (Map)rows.next();
              result.addValue((String)rowMap.get("Password"));
    catch(Exception e){
         result.addValue(e.getMessage());
    finally{
         try{
              if(accessor != null)
                   accessor.close();
         }catch(Exception e){
              result.addValue(e.getMessage());
    And the i have mapped like this
    UserName -
    > DBProcessing_SpecialAPI----
    >PhoneNumber
    when i am testing this mapping i am getting the following error
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Dest_JDBC_MT xmlns:ns0="http://filetofilescenario.com/ilg"><phoneNumber>Plain exception:Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.<init>(AdapterProxyLocal.java:61)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.getProxy(SystemAccessorInternal.java:98)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.<init>(SystemAccessorInternal.java:38)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.getConnection(SystemAccessorHmiServer.java:270)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:70)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    </phoneNumber></ns0:Dest_JDBC_MT>
    In RWB i have checked the status of JDBC driver its showing the following error
    <b>Value missing for mandatory configuration attribute tableEOColumnNameId</b>
    Best Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B

  • How to list column names and data types for a given table using SQL

    I remember that it is possible to use a select statement to list the column names and data types of databaase tables but forgot how its done. Please help.

    You can select what you need from DBA_TAB_COLUMNS (or ALL_TAB_COLUMNS or USER_TAB_COLUMNS).

  • How can I edit column name/heading in Column Attributes?

    Hi All,
    In the link "*Home>Application Builder>Application 1000>Page 2>Report Attributes>Column Attributes*", can someone help me how to edit/modify 'Column Name' and 'Column Heading' ?
    Thanks in advance.
    Regards
    Sharath

    Hi,
    There is Headings Type radio buttons above report column attributes.
    Select Headings Type "Custom" and then you can change Headings.
    Column names (Alias) you need change to report query.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • How do I obtain column names and types?

    I am using Visual Studio C++ to connect and query an Oracle database using SQL commands. My code works, but I don't fully understand it because I'm new to Oracle and it is modified example code.
    I need to obtain column names and types for a known table. The "Describe" SQL command fails when I call ->Execute, claiming this is an invalid SQL statement, although the same statement works when sent directly via sqlplus.
    I need column names and types, but they don't have to come through Describe.

    Hi,
    Desc isn't really a SQL command. Rather its a command specific to Oracle. Thats why it will work in SQLPlus and not anywhere else. If you want the column information for a table you can user either the user_tab_columns or all_tab_columns, depending on which schema the table is in. The query would look like:
    select * from all_tab_columns where table_name = 'BONUS'
    Sanjay

  • Display First Name and Last Name of generating user in Siebel BIP Report

    Hello,
    My client has a requirement to display First Name and Last Name of user who generated the report. I need some help to resolve this requirement. Thanks
    Eg: Generated by <First Name> <Last Name>
    Generated by Siebel Administrator
    Regards,
    Hari Venkat.

    Hey Rob,
    Is this search help something that you have developed?  Can you explain a little more to how the funcitonality works?  Is this triggering an operation in your BAdI?
    Cheers,
    Kevin

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

Maybe you are looking for

  • Remote not working on dvr but works on other boxes

    I have a Dvr box in the back of the house, It was working fine today earlier. I went back in the room and poof the remote dosent work on the box. It still works the tv. So I took it out to the other boxes in the house and it works fine on the other b

  • Express document "Update was terminated" received from author "    "in VA21

    Dear SAP Experts,   i just set up Output determination for quotation type. and created VA21, while coming out i am getting error as Express document "Update was terminated" received from author "  below is the dump i am getting. Could you please help

  • Pacman -Syu returns system up to date after a new 2008.03 (solved)

    I just installed arch from the march 08 live cd (the new cd got stuck on the grub boot screen, but that is another bug for another thread). I eventually got a totally working installation (installing only core packages). what's strange is, i've updat

  • 60 GB Video Ipod ..

    So basically, My warrenty just ran up a few days ago. My ipod hard drive crashed, I went to the Apple Store and they said their was nothing they could do for my 400 dollar ipod. How unfair is that? I contacted Apple and they told me theirs a year war

  • Tcode for Purchase order Changes

    Hello Expert I Know there is one Tcode from which we could find changes happen in Purchase order at item level . Can any one let me know on the same which Tcode. I know the regular option by selecting the line item Environment->Item changes thanks Ab