Simple echo, or print in SQLPlus ?

Hi:
I'm running an sql script for which I would like to echo the commands being run. What I'm looking for would be similar to "set verify" in the SQL interface for Oracle-RDB. Barring that, a simpe way to "echo" a simple literal would suffice. I used to use "select 'foo' from dual;", but that doesn't always work....
SQL> select 'mml_gdcp8rf020_easx070' from dual;
select 'mml_gdcp8rf020_easx070' from dual
ERROR at line 1:
ORA-00600: internal error code, arguments: [17182], [1075506792], [], [], [], [], [], []
Is there a different way to do this?

Well, to cause the commands to be echoed when they are run, do this :-
SET ECHO ON TERMOUT ON
You can find out more about this command on :-
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1012498
That ORA-00600 worries me though.

Similar Messages

  • When printing in Excel It is always want to use the acrobat X pro trial, which the trial is expired. I do not want to use acrobat X pro trial anymore. How can I reset it and use simple acrobat to print my PDF document?

    When printing in Excel It is always want to use the acrobat X pro trial, which the trial is expired. I do not want to use acrobat X pro trial anymore. How can I reset it and use simple acrobat to print my PDF document?

    Hi screen name,
    Adobe PDF printer gets installed when you install Acrobat 10 Pro.
    To use this printer you need to purchase Acrobat. Once the trial period is over you cannot use the printer to create pdf files.
    An alternative way for you is to utilize Microsoft's own inbuilt pdf engine.
    You can simply open the file and select 'Save as' and in the type list select 'pdf'
    Please refer : http://office.microsoft.com/en-in/excel-help/save-as-pdf-HA010354239.aspx
    Regards,
    Rave

  • 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

  • Simple vector transparency - printing problems

    Morning everybody,
    I'm having problems printing a PDF which has been generated from Indesign CS3.  The problem also arises when printing directly from Indesign.  Everything appears OK when on screen.
    I have a background colour, in front of which i have placed an Illustrator CS3 file which is a row of white squares with gaps (transparent) between then.  The squares are white, but I really want them to fade from a hue of the background colour to fully transparent.  To achieve this I have used a gradient feather, going from opacity 50% to opacity 0%.  [See sceenshot]
    My problem is that all the squares show up when I print the file, even the ones which should have an opacity level of 0%.  On the printout the gradient feather is visible (i.e. the squares 'fade out'), but they do not compeltely fade out to fully transparent. 
    Does anyone have any tips? 
    Thanks very much for any help with this. 
    Robin

    Thanks a lot for your reply.
    I don't have a brilliant understanding of colour, but I believe that all the colours in the document are process [see screenshot].
    Turning on overprint preview doesn't change the appearance of the document.  Nor does turning on simulate overprint in acrobat.  In both cases, the appearance of the document on screen is how i want it to print.

  • Developing a simple echo sounder

    Dear All
    I am a final year science student trying to use Laview 4.1 in order to produce and run a virtual echo sounder. My main problem is that i need to retrieve a sound echo from an underwater microphone and record and display the signal using labview 4.1. Is there a VI that allows the user to record sound? and if so can, where can i find it?
    Thanks
    Giacomo

    Hi,
    use JavaMail, documentation, Google and RFCs are your friends.

  • Simple printer for my network (connected to windows pc)

    I'm looking for a printer to connect to a windows PC that will let me print through the network from my MacBook and iMac.
    I just want a simple and cheap printer, nothing too fancy.
    I've got a HP3650 now, but I cant get it too work like this (tried everything from standard osx drivers to cups, foomatic, gutenprint etc..) But nothing seemed to work for me.

    I would recommend you purchase a printer that has its own network card (wired or wireless). That way you don't need to share it from Windows, allowing the Mac's to connect directly to the printer using their provided driver.

  • Simple, reliable ink jet printer scanner

    My HP multifunction printer won't scan documents and overall ***** at this point.
    I am looking for a simple ink jet printer to print documents, photos and scan. Preferably, one easy on ink! Any input would be most appreciated.
    Thanks,
    Ozzie

    Hi, I use HP's mine C4480 ~ Wifey F2430 - Both work gr8 with our Macs..L

  • Host command from sqlplus based on a condition

    I am on an Oracle 10.2.0.3.0 database running on sun solaris.
    Am using my sqlplusw on my windows xp professional to do the below :
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    TNS for Solaris: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    I have 4 variables declared in sqlplus for which I get my values from anonymous pl/sql blocks :
    print db1_status;
    DB1_STATUS
    3
    print db2_status;
    DB2_STATUS
    0
    print db3_status;
    DB3_STATUS
    1
    print db4_status;
    DB4_STATUS
    0
    I needed some help with doing this :
    Based on the values of each these variables, I wanted to invoke the host command to run stuff like
    if db1_status = 3 then
    host ...something
    if db2_status = 0 then
    host ...something
    I am looking for a way to do this without creating an external procedure or java stored programs. Are there any?
    Thanks

    Need to use a batch file (.bat) to utilize SQL Plus while generating the SQL statements within the .bat file.
    Example:
    Inside SQL Plus
    SQL> create table testme (name varchar2(255), value number(5));
    Table created.
    SQL> insert into testme(name, value) values ('db1_status', 3);
    1 row created.
    SQL> insert into testme(name, value) values ('db2_status', 0);
    1 row created.Create a .bat file (Using test.bat)
    test.bat
    @echo off
    echo select value from testme where name = 'db1_status';>temp.sql
    echo exit >> temp.sql
    sqlplus -S %2/%3@%1 @temp.sql > result.dat
    for /f %%x in ('more result.dat') do set RESULT=%%x
    if "%RESULT%" == "3" goto :DB1_STATUS_3
    if not "%RESULT%" == "3" goto :DB1_STATUS_NOT_3
    goto :EOF
    :DB1_STATUS_3
    echo db1_status = 3
    **ENTER SYS COMMANDS HERE**
    goto :EOF
    :DB1_STATUS_NOT_3
    echo db1_status != 3
    **ENTER SYS COMMANDS HERE**
    goto :EOF
    echo select value from testme where name = 'db2_status';>temp.sql
    echo exit >> temp.sql
    sqlplus -S %2/%3@%1 @temp.sql > result.dat
    for /f %%x in ('more result.dat') do set RESULT=%%x
    if "%RESULT%" == "0" goto :DB2_STATUS_0
    if not "%RESULT%" == "0" goto :DB2_STATUS_NOT_0
    goto :EOF
    :DB2_STATUS_0
    echo db2_status = 0
    **ENTER SYS COMMANDS HERE**
    goto :EOF
    :DB2_STATUS_NOT_0
    echo db2_status != 0
    **ENTER SYS COMMANDS HERE**
    goto :EOF
    :EOF
    del temp.sql
    del result.dat
    @echo onAs you can see, this is a simple if/then which takes the value from a dynamically created SQL file (temp.sql) and uses it do determine the next system commands to execute.
    Hope this is what ya needed.
    -Tim

  • Adobe PS CS3 has major flaws in Print Dialog. Beware!

    System Specs:
    OSX Leopard 10.5.2
    MacPro 3.2ghz with 32GB of ram 1.5GB Video
    Epson 11880 Printer
    Samsung XL20 LED monitors calibrated using EyeOne Pro 6500k 2.2 and 120c/d
    I have been trying to build a custom profile for my new Epson 11880. However, my results have been unsuccessful. All my prints came out super dark. The color is all off except for the grey scale.
    After talking to Epson for hours I found out that the new Beta driver for the printers have a problem, so rolled back to v3.89. This fixed all printer problems. So printer is fine now. This also applies to the Epson 3800.
    Spoke to Apple about their color management and Leopard issues? No fault found on the OS.
    Ran a test using preview, iPhoto, EyeOneMatch, Photoshop CS, and CS3. I couldn't find my CS2 disk so I didn't get a chance to test that. preview, iPhoto, CS, and EyeOneMatch all came out with same results when printing a 9.18 target without PCM. However, CS3 printed the image dark and off color with the exact same settings. Problem has been persistent and I would like to conclude that CS3 needs to fix this bug in their software. It is ridiculous to be printing using another software because CS3 can't do a simple task as print.

    viewing conditions are fine.
    I have the whole room outfitted with GTI D50 lights. What can I say I am anal. No matter where you stand the light will hit 5000k. I change the bulbs out every 1500 hours although they tell me I can wait until 2000 hours.
    My monitor is also calibrated properly. I am using the Samsung XL20 and XL30 monitors, which surpass the Eizo or any other LCD's on the market. I've owned the Eizo, NEC, Artisan, and any other monitors you can name. I also made sure my Spectrometer is fine and it is.
    When printing targets with the setting set to NO Color Management in Photoshop it should yield the same results as the other applications. The only thing you are technically utilizing then is the printer driver and dialog box. Yes the printer dialog is always same and set properly also. PCM is set to no color management. I've tested this with other applications and it is CS3 that is giving me all the problems.

  • How do i print calendar from icloud using windows 7?

    Forgive me if this question is out there and has been
    answered – I’m sure it is but I can’t find it.
    How do I print a day or series of days of my calendar from icloud?
    I have an ipad mini and ipad 2 but I want to print the calendar from icloud
    using a laptop with Windows 7.
    Any assistance would be greatly appreciated.
    Thanks

    I am tempted to answer that question with one simple sentence - " using printer".
    I understand that there is some underlying concern, just can't guess what it is yet. May be you can elaborate...

  • How to print in captivate 5 - no widget

    Hi,
    I've seen various posts about using a widget to print a window/slide  "made from" Captivate 5.
    As I work in gov and their security policy is restrictive (for good reason I suppose), I can't download this widget.
    Is there another way I can get a slide to print? I was trying to do an execute javascript thing on a button, but that doesn't work.
    I published the file, went into the HTML and tinkered with it as per codelifter: and this post http://forums.adobe.com/thread/765038?tstart=0
    ============================================================
    Script:     Print Current Window From A Link
    Function:   Opens printer dialogue to print current page
    Browsers:   Version 4 and later (others degrade gracefully)
    Author:     etLux
    ============================================================
    Step 1.
    Put the following script in the head of your page.
    <script>
    // (C) 2000 www.CodeLifter.com
    // http://www.codelifter.com
    // Free for all users, but leave in this  header
    function printWindow(){
       bV = parseInt(navigator.appVersion)
       if (bV >= 4) window.print()
    </script>
    ============================================================
    Step 2.
    Put the following in the body of your page.
    <a href="javascript:printWindow()">Print This Page</a>
    ============================================================
    I couldn't do step two, because the html is per project not slide/page, but before I published I put in the script window
    "javascript:printWindow()" for "on Success" (ie clicking the button)
    It doesn't print though.
    Should I be using advanced actions instead?
    I have created a slide with text captions that have fields with a background of  a certificate. I want users to be able to print the certificate.
    Thank you
    Adrienne

    Unfortunately, I think you're going to find that the Print Widget is your best option.  It's an excellent widget that fills a very big gap in Cp functionality, the simple task of printing out a runtime slide.
    It doesn't really represent a security threat, but if you are trying to download it as a wdgt file, the reason your network is blocking this is that it probably doesn't know what this file ending is for, so it assumes it must be something nasty.  Secured networks usually have a limited list of file endings that are permitted and this one (.wdgt) is unique to Cp widgets.
    But a widget can also be a simple SWF file as well.  It doesn't have to be .wdgt to work.
    Contact the creator of the Print Widget: http://www.cpguru.com/2010/09/03/intelligent-print-widget-for-adobe-captivate-4-and-adobe- captivate-5/
    You should be able to get him to supply you with an SWF version of the widget (after you purchase it).
    If your network currently allows you to view Flash content at all, it already allows SWF files, so this widget should not be blocked in any way.
    All the other routes you describe above are a lot more trouble and far less likely to work reliably.

  • Problem printing the JTable

    Hi all,
    I have a problem with printing JTable.
    My application has a submit button,JTable and Print Button.
    As I click on the Submit button, the data is retrieved from the Database(MS Access) and displayed on the JTable.
    Now when I click on the Print button, the printer properties dialog box is displayed. But when I click on the print button in the dialog box, nothing is printed on the paper.
    I checked the printers and faxes in the control panel, It showed Java printing under the Document name and Printing under the Status. It is displayed for sometime and then disappeared after some time. But nothing is printed on the paper(not even the blank paper).
    I tried a lot but couldn't understand the problem.
    I have used the following files:
    PrintJTable.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.awt.geom.*;
    import java.awt.Dimension;
    import java.applet.*;
    import java.sql.*;
    import java.util.*;
    import java.net.*;
    import java.lang.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    class PrintJTable implements ActionListener,Printable
    Connection connect;
    ResultSet rs;
    JTable table;
    JScrollPane tableAggregate;
    DisplayTable displayTable;
    JButton print,submitButton;
    public PrintJTable()
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    connect();
    displayTable= new DisplayTable();
    JButton submitButton= new JButton("SUBMIT");
    submitButton.addActionListener(this);
    JButton printButton= new JButton("PRINT!");
    // for faster printing turn double buffering off
    RepaintManager.currentManager( frame).setDoubleBufferingEnabled(false);
    printButton.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent evt) {
    PrinterJob pj=PrinterJob.getPrinterJob();
    pj.setPrintable(PrintJTable.this);
    pj.printDialog();
    try{
    pj.print();
    }catch (Exception PrintException) {}
    tableAggregate = createTable();
    tableAggregate.setBorder(new BevelBorder(BevelBorder.LOWERED));
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(submitButton,BorderLayout.NORTH);
    frame.getContentPane().add(tableAggregate,BorderLayout.CENTER);
    frame.getContentPane().add(printButton,BorderLayout.SOUTH);
    frame.pack();
    frame.setVisible(true);
    } // end of constructor
    public void connect()
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Opening db connection");
    connect = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/db1.mdb","","");
    catch (ClassNotFoundException ex) {
    System.err.println("Cannot find the database driver classes.");
    System.err.println(ex);
    catch (SQLException ex) {
    System.err.println("Cannot connect to this database.");
    System.err.println(ex);
    public JScrollPane createTable() {
    displayTable= new DisplayTable();
    JTable table = new JTable(displayTable);
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         table.getTableHeader().setReorderingAllowed(false);
    JScrollPane scrollpane = new JScrollPane(table,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    return scrollpane;
    } // end of createTable()
    public void actionPerformed(ActionEvent ie)
    try
    Statement statement6=connect.createStatement();
    ResultSet rs6=statement6.executeQuery("select * from benf_details");
    displayTable.executeQuery(rs6);
    statement6.close();
    catch(SQLException sqle)
    JOptionPane.showMessageDialog(null,"error2"+sqle);
    }// end of actionPerformed
    public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
    Graphics2D g2 = (Graphics2D)g;
    g2.setColor(Color.black);
    int fontHeight=g2.getFontMetrics().getHeight();
    int fontDesent=g2.getFontMetrics().getDescent();
    double pageHeight = pageFormat.getImageableHeight()-fontHeight; //leave room for page number
    double pageWidth = pageFormat.getImageableWidth();
    System.out.println("page width = " + pageWidth );
    double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
    System.out.println("table width = " + tableWidth );
    double scale = 1;
    if (tableWidth >= pageWidth) {
    scale = pageWidth / tableWidth;
    System.out.println("scale = " + scale );
    double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
    double tableWidthOnPage = tableWidth * scale;
    double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
    int numRowsOnAPage = (int)((pageHeight - headerHeightOnPage) / oneRowHeight);
    double pageHeightForTable = oneRowHeight * numRowsOnAPage;
    int totalNumPages = (int)Math.ceil(((double)table.getRowCount())/numRowsOnAPage);
    if(pageIndex >= totalNumPages) {
    return NO_SUCH_PAGE;
    g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    g2.drawString("Page: "+ (pageIndex + 1),(int)pageWidth / 2 - 35,
    (int)( pageHeight + fontHeight - fontDesent ));//bottom center
    g2.translate( 0f, headerHeightOnPage );
    g2.translate( 0f, -pageIndex * pageHeightForTable );
    //If this piece of the table is smaller than the size available,
    //clip to the appropriate bounds.
    if (pageIndex + 1 == totalNumPages) {
    int lastRowPrinted = numRowsOnAPage * pageIndex;
    int numRowsLeft = table.getRowCount() - lastRowPrinted;
    g2.setClip(0, (int)(pageHeightForTable * pageIndex),
    (int) Math.ceil(tableWidthOnPage),
    (int) Math.ceil(oneRowHeight * numRowsLeft));
    //else clip to the entire area available.
    else{
    g2.setClip(0, (int)(pageHeightForTable * pageIndex),
    (int) Math.ceil(tableWidthOnPage),
    (int) Math.ceil(pageHeightForTable));
    g2.scale(scale,scale);
    table.paint(g2);
    g2.scale(1/scale,1/scale);
    g2.translate( 0f, pageIndex * pageHeightForTable);
    g2.translate( 0f, -headerHeightOnPage);
    g2.setClip(0, 0,(int) Math.ceil(tableWidthOnPage), (int)Math.ceil(headerHeightOnPage));
    g2.scale(scale,scale);
    table.getTableHeader().paint(g2);//paint header at top
    return Printable.PAGE_EXISTS;
    } // end of print()
    public static void main(String[] args) {
    new PrintJTable();
    }// end of PrintJTable
    DisplayTable.java
    import java.util.Vector;
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.event.TableModelEvent;
    public class DisplayTable extends AbstractTableModel {
    Connection connection;
    Statement statement;
    ResultSet resultSet;
    String[] columnNames = {};
    Vector          rows = new Vector();
    ResultSetMetaData metaData;
    String db_uname,db_passwd;
    public DisplayTable() {
    public void executeQuery(ResultSet resultSet) {
    try {
    metaData = resultSet.getMetaData();
    int numberOfColumns = metaData.getColumnCount();
    columnNames = new String[numberOfColumns];
    // Get the column names and cache them.
    // Then we can close the connection.
    for(int column = 0; column < numberOfColumns; column++) {
    columnNames[column] = metaData.getColumnLabel(column+1);
    // Get all rows.
    rows = new Vector();
    while (resultSet.next()) {
    Vector newRow = new Vector();
    for (int i = 1; i <= getColumnCount(); i++) {
         newRow.addElement(resultSet.getObject(i));
    rows.addElement(newRow);
    // close(); Need to copy the metaData, bug in jdbc:odbc driver.
    fireTableChanged(null); // Tell the listeners a new table has arrived.
    catch (SQLException ex) {
    System.err.println(ex);
    public void close() throws SQLException {
    System.out.println("Closing db connection");
    resultSet.close();
    statement.close();
    connection.close();
    protected void finalize() throws Throwable {
    close();
    super.finalize();
    // Implementation of the TableModel Interface
    // MetaData
    public String getColumnName(int column) {
    if (columnNames[column] != null) {
    return columnNames[column];
    } else {
    return "";
    public Class getColumnClass(int column) {
    int type;
    try {
    type = metaData.getColumnType(column+1);
    catch (SQLException e) {
    return super.getColumnClass(column);
    switch(type) {
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
    return String.class;
    case Types.BIT:
    return Boolean.class;
    case Types.TINYINT:
    case Types.SMALLINT:
    case Types.INTEGER:
    return Integer.class;
    case Types.BIGINT:
    return Long.class;
    case Types.FLOAT:
    case Types.DOUBLE:
    return Double.class;
    case Types.DATE:
    return java.sql.Date.class;
    default:
    return Object.class;
    // to make the cells editable
    public boolean isCellEditable(int row, int column) {
    try {
    return metaData.isWritable(column+1);
    catch (SQLException e) {
    return false;
    public int getColumnCount() {
    return columnNames.length;
    // Data methods
    public int getRowCount() {
    return rows.size();
    public Object getValueAt(int aRow, int aColumn) {
    Vector row = (Vector)rows.elementAt(aRow);
    return row.elementAt(aColumn);
    public String dbRepresentation(int column, Object value) {
    int type;
    if (value == null) {
    return "null";
    try {
    type = metaData.getColumnType(column+1);
    catch (SQLException e) {
    return value.toString();
    switch(type) {
    case Types.INTEGER:
    case Types.DOUBLE:
    case Types.FLOAT:
    return value.toString();
    case Types.BIT:
    return ((Boolean)value).booleanValue() ? "1" : "0";
    case Types.DATE:
    return value.toString(); // This will need some conversion.
    default:
    return "\""+value.toString()+"\"";
    public void setValueAt(Object value, int row, int column) {
    try {
    String tableName = metaData.getTableName(column+1);
    // Some of the drivers seem buggy, tableName should not be null.
    if (tableName == null) {
    System.out.println("Table name returned null.");
    String columnName = getColumnName(column);
    String query =
    "update "+tableName+
    " set "+columnName+" = "+dbRepresentation(column, value)+
    " where ";
    // We don't have a model of the schema so we don't know the
    // primary keys or which columns to lock on. To demonstrate
    // that editing is possible, we'll just lock on everything.
    for(int col = 0; col<getColumnCount(); col++) {
    String colName = getColumnName(col);
    if (colName.equals("")) {
    continue;
    if (col != 0) {
    query = query + " and ";
    query = query + colName +" = "+
    dbRepresentation(col, getValueAt(row, col));
    System.out.println(query);
    System.out.println("Not sending update to database");
    // statement.executeQuery(query);
    catch (SQLException e) {
    // e.printStackTrace();
    System.err.println("Update failed");
    Vector dataRow = (Vector)rows.elementAt(row);
    dataRow.setElementAt(value, column);
    }

    Java 1.5 incorporates a very simple way to print from a JTable. I am using a mysql DB but it is the same concept. Review my code and let me know if you have any questions.
    package emsmain;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    import java.sql.*;
    import java.text.MessageFormat;
    import java.util.*;
    import javax.print.*;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.swing.*;
    import javax.swing.JTable;
    import javax.swing.table.*;
    import java.awt.print.*;
    public class TableFromDatabase extends JFrame implements ActionListener{
        JButton jbtprint = new JButton("Print Report");
        JTable Reporttable;
        Connection conn = Connect_Database.getConnection();
         public TableFromDatabase()
    Vector columnNames = new Vector();
    Vector data = new Vector();     
              try{  
                String query = null;
                Statement ps = null;
                ResultSet rs = null;
                  //Class Master List
                  if (Report_Menu.jrbMaster_list.isSelected()){
                      query =("Select * from students") ;
                  //Classes taken by student
                  if (Report_Menu.jrbClass_taken.isSelected()){
                      String taken = Report_Menu.jtfStudent.getText();
                      query = ("select program.course_num, course_name, course_start_date, course_stat_desc from registration, program where student_id = '"+taken+"' and program.course_num = registration.course_num");
                  //Birthday report
                  if (Report_Menu.jrbBirthday.isSelected()){
                      String birthday = (String) Report_Menu.jcb_birthday.getSelectedItem();
                      query = ("SELECT student_id, fname, lname, address, city, state_name, zipcode, dob FROM students where substring(dob, 6,2) = '"+birthday+"'"); 
                  //Course Catologue
                  if (Report_Menu.jrbCourseCatologue.isSelected()){
                      String course = (String) Report_Menu.jcbChooseCourse.getSelectedItem();
                      query = ("select  course_name, course_length, course_cost, course_credits from course where course_name = '"+course+"'");
                  //Certification expiration report
                  if (Report_Menu.jrbExpiration.isSelected()){
                      String month = (String) Report_Menu.jcbMonth.getSelectedItem();
                      String year = (String) Report_Menu.jcbYear.getSelectedItem();
                      query = ("SELECT FNAME, LNAME FROM STUDENTS, REGISTRATION WHERE substring(expiration_date, 6,2) = '"+month+"' and substring(expiration_date, 1,4) = '"+year+"' and registration.student_id = students.student_id") ;
                  //Class Roster
                  if (Report_Menu.jrbRoster.isSelected()){
                      String c_number = Report_Menu.jtfClassNumber.getText();
                      query = ("Select course_name, course_start_date, fname, lname from program, registration, students where program.course_num = '"+c_number+"' and registration.student_id = students.student_id;");
                  //Squad list and counts
                  if (Report_Menu.jrbSquadCount.isSelected()){
                      query = ("SELECT Squad_Name, count(student_id) from students group by Squad_Name");
                  //Student List
                  if (Report_Menu.jrbStudent_list.isSelected()){
                      String Choose_month = (String) Report_Menu.jcbcourse_month.getSelectedItem();
                      String Choose_Course = (String) Report_Menu.jcbcourse_name.getSelectedItem();
                      query = ("select count(student_id) from (registration, program) where program .course_name = '"+Choose_Course+"' and substring(course_start_date, 6,2) = '"+Choose_month+"'and registration.course_num = program.course_num;");
                ps = conn.createStatement();
                //Run Selected Report
                ps.execute(query);
                rs = ps.executeQuery(query);
                ResultSetMetaData md = rs.getMetaData();
                int columns = md.getColumnCount();
                //  Get column names
                for (int i = 1; i <= columns; i++)
                    columnNames.addElement( md.getColumnName(i) );
                //  Get row data
                while (rs.next())
                    Vector row = new Vector(columns);
                    for (int i = 1; i <= columns; i++)
                        row.addElement( rs.getObject(i) );
                    //add row data to JTable
                    data.addElement( row );
                rs.close();
                ps.close();
            catch(Exception e)
                JOptionPane.showMessageDialog(null,e.getMessage());
            //  Create Jtable with database data 
            Container c = getContentPane();
            c.setLayout(new BorderLayout());
            Reporttable = new JTable(data, columnNames);
            JScrollPane scrollPane = new JScrollPane( Reporttable );
            c.add( scrollPane );
            JPanel buttonPanel = new JPanel();
            buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
            buttonPanel.add(jbtprint);
            c.add(buttonPanel,BorderLayout.SOUTH);
            jbtprint.addActionListener(this);
        public void actionPerformed(ActionEvent e){
             if(e.getActionCommand().equals("Print Report")){
               PrintForm();
    public void PrintForm(){ 
         try {
             String name = null;
             // Will display correct heading for print job
             if (Report_Menu.jrbMaster_list.isSelected()){
             name = "Master List";
             if (Report_Menu.jrbBirthday.isSelected()){
             name = "Birthday List";
             if (Report_Menu.jrbClass_taken.isSelected()){
             name = "Classes taken by Student";
             if (Report_Menu.jrbCourseCatologue.isSelected()){
             name = "Course Catalogue";
             if (Report_Menu.jrbExpiration.isSelected()){
             name = "Certification Expiration Report";
             if (Report_Menu.jrbRoster.isSelected()){
             name = "Class Roster";
             if (Report_Menu.jrbSquadCount.isSelected()){
             name = "Squad list with Student Counts";
             if (Report_Menu.jrbStudent_list.isSelected()){
             name = "Student count by Course";
             // fetch the printable
             Printable printable = Reporttable.getPrintable(JTable.PrintMode.FIT_WIDTH,
                                                      new MessageFormat(name),
                                                      new MessageFormat("Page - {0}"));
             // fetch a PrinterJob
             PrinterJob job = PrinterJob.getPrinterJob();
             // set the Printable on the PrinterJob
             job.setPrintable(printable);
             // create an attribute set to store attributes from the print dialog
             PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
             // display a print dialog and record whether or not the user cancels it
             boolean printAccepted = job.printDialog(attr);
             // if the user didn't cancel the dialog
             if (printAccepted) {
                    try {
                          // do the printing (may need to handle PrinterException)
                        job.print(attr);
                    } catch (PrinterException ex) {
                        ex.printStackTrace();
         } finally {
             // restore the original table state here (for example, restore selection)
    }

  • How to suppress print dialog box from popping up under a condition

    Greetings...
    There may be a better way to accomplish what I'm trying to do, so I'm open to outside-the-box suggestions.
    I have a pretty simple page which lists a set of statuses and descriptions of each. The user can edit these status flags and their descriptions on the page as well. When I view the page in "printer friendly" mode, I see a nice simple report of what the statuses are and their descriptions. Everything works great so far.
    In our work request system built in ApEx, there's a page where someone can view the details of a work request, including the current status. When someone clicks on the help of that item, what I'd love to do is simple show the "printer friendly" version the status page mentioned above in a pop up window. My problem is that the print dialog box automatically shows up when a page is displayed in "printer friendly" mode and I do not want this to happen in this case.
    I see the javascript code in the Printer Friendly page template which causes the print dialog box to show up automatically, but I don't want to remove it in the template just for this one case. This would suppress the print dialog box on all "printer friendly" page views and the users are used to it showing up when they ask to print the page.
    I guess I could create a custom request to pass to the master status page which would pretty much do everything that the "printer friendly" mode is doing, but that seems like a lot of work when I'm so close to using something that is built in.
    Am I not seeing some simple other way of doing it or perhaps asking too much? Any suggestions?
    Shane.

    Hi,
    I think you have to call the FM GET_PRINT_PARAMETERS and pass NO_DIALOG = 'X'.
    Something like:
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog      = 'X'
        IMPORTING
          out_parameters = ls_params
          valid          = lv_valid
        EXCEPTIONS
          OTHERS         = 1.
      NEW-PAGE PRINT ON PARAMETERS ls_params NO DIALOG.
    * Display Table
      lr_table->display( ).
    add: Spool numbers can be found in TSP01 or in system field SY-SPONO available in the submitting program...
    Hope it helps,
    Kr,
    m.
    Edited by: Manu D'Haeyer on Sep 28, 2011 10:02 AM

  • How do I print front and back with two pages per sheet? (OSX Lion)

    I can't find a simple solution to my situation...
    I'm using Max OSX Lion 10.7.3 and Adobe Reader X 10.1.2. 
    I want print two PDF pages onto one printed sheet, and I want to print front and back.  When I go to the print settings and select two pages per printed sheet, the sample window shows me what I'm looking for.  But when I tell it to print odd only or even only, it changes the print selection.  Here's what happens...
    Let's say I have a PDF document that is 20 pages long.  When I tell it to print two PDF pages per sheet, it shows me that the first pages printed will be PDF pages 1 and 2.  When I tell it that I want it to print odd pages only, it tells me that the first printed page will contain PDF pages 1 and 3.
    In other words, Adobe Reader wants to print the odd PDF pages instead of the odd pages of the printed document (PDF pages 1 and 2, then 5 and 6, then 9 and 10, so on).
    So that I'm being clear...
    This [  ] is a printed page.  The numbers inside the brackets represent the page numbers in the PDF document...
    What I want to print is this...
      FRONT   ||  BACK
    [1,2]    ||  [3,4]
    [5,6]    ||  [7,8]
    [9,10]   ||  [11,12]
    [13,14]  ||  [15,16]
      [17,18]  ||  [19,20]
    What would end up printing is this...
      FRONT   ||  BACK
      [1,3]    ||  [2,4]
      [5,7]    ||  [6,8]
      [9,11]   ||  [10,12]
      [13,15]  ||  [14,16]
      [17,19]  ||  [18,20]
    Aside from telling it exactly which PDF page numbers to print (this would be a taxing job because I'm working with a 273 page document), is there an easy and simple way to print how I'd like?

    I would suggest to use Adobe Ilustrator. Also I get an error message when I try tp access the sample document.
    You can download Illustrator using Adobe Creative download - http://www.adobe.com/products/illustrator.html
    ~Deepak

  • How to develop/print a report wider than 8.5 inches, why cant we landscape

    Hi All Gurus,
    I am new to Oracle Reports. I have a problem, I have a report that has rows longer than normal A4, A5, A6 paper width, so report lines either tend to go on next page or on next line of the same page. Also Oracle Report is not allowing me to print report in landscape mode, why this limitation ? I am wondering, cuz in older character based tools (Foxpro, Informix-4GL), we could easily print wider reports on a line printer which always had a capacity of 132 characters (and in condensed mode, 224 characters). So only small (and very simple) reports were printed on regular paper of 80 characters (8.5 inches wide), but for almost all real use reports we were able to use 132 (224 in condensed) characters paper.
    How can we do this ith Oracle GUI report builder?. Why are we limited to 80 character paper size? why cant we print report in landscape mode? It is not, in any case, allowing me columns that go beyond 80 characters (8.5 inches) on a line. If this is an Oracle limitation, I would say Oracle Reports cannot be used for actual reporting, it is just a fancy with GUI and colors!!!!!
    Can anybody answer my questions? please tell me an immediate solution.
    Thanks in Advance

    You can go to Object Navigator, under Layout Model, click the Main Section icon to open the property, change to Width from 8.5 to 11 and Height from 11 to 8.5. Do the same for Header/Trailer Sections if needed.
    At report printing, choose Landscape Orientation.
    DC

Maybe you are looking for