Question about setting column width in SQL*Plus using info retrieved w SQL

Good morning,
Is there a way to tell SQL*Plus to set the width of a column to the greatest width of the elements found in the column ? (as opposed to the default which is the width declared in the DDL)
In other words, I'd like to do something functionally equivalent to this:
COL <columname> format a[select max(length(<columnname>)) from <thetablethatcontainscolumname>]
I'm doing the above manually in two steps
1. select max(length(columnname)) from .....
2. col columnname format a[resultofstep1]
Is there a way of doing it in one step ?
Thank you for your help,
John.

Hi Munky,
>
you should consider whther you are using the correct tool for the job, SQLplus isn't exactly ideal for doing presentation layer stuff
>
I'm not really doing presentation stuff, I asked because it would be very convenient for everyday stuff. I commonly query the tables that I am going to deal withm just to have a look at the column names and a few values, something like:
select * from EMP where rownum <= 10; -- just to have a look at the table and some values
when the table contains a wide column then the display gets all messed up. It would be nice to have an option or a mechanism to tell SQL*Plus to automatically use the width of the widest value, instead of having to determine the value and then manually set the column.
thank you for your help, it's good to know that I didn't miss some trivial setting in the documentation that would do it ;)
John.

Similar Messages

  • Set Column width in query (not using SQL*Plus)

    How can I Set Column width in query
    I understand you can set column width using
    column col1 FORMAT A5
    select col1 from table1;But this only works in SQL*Plus
    I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
    I am using a 'SQL window' in PL/SQL Developer IDE
    and when I use this syntax it says:
    ORA-00900: Invalid SQL statement
    Any suggestions are appreciated...
    thanks,
    M.

    Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
    e.g.
    SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
    Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM

  • Question about setting opacity in DW Cs6, without using rgba

    Hello,
    I prefer not to use html5/css3 until there are no more windows xp accessing the internet. However, the html5/css3 functions are pretty nifty and I would like to find a ie8 friendly way of doing similar stuff. I would like to set the opacity of my background colors between my <div></div> and not use rgba, but rather hex, but NOT change the text color at all. I would prefer to do it in the css editor rather than hand coding if possible. Is there a way to do this?
    I'm new to the new stuff. Last time I built a site was back in 2007 using Frontpage 2003:)
    Thanks

    Without using rgba, you would be stuck with the opacity atribute if wanted to just use css. The problem with the opacity attribute (and filter for IE) is they affect the entire html element they are applied to and its contents.
    The only way to have a background with some opacity/transparency without using rgba for the background-color attribute is to use what Gramps points out. Create an image in Photoshop, add your color to a new layer, drop the opacity of the layer to the level you want. Remove any background layer (so you have just the checkerboard background with your partially transparent color over the top of it) then save it as a PNG-24.

  • How can I set column width in JTable?

    How can I set column width in JTable?

    Also, read the JTable API before posting questions. You will find a link to the Swing tutorial on "How to Use Tables", which contains an example of doing exactly this.

  • Setting column width in a command-line program

    Is there a way to send data to the screen in a command-line Java program that will be formatted as a number
    of columns with a set column width? I am looking for something similar to the C++ setw() I/O manipulator
    used in cout.
    Thanks,
    Steve

    If you go to: http://java.sun.com/docs/books/tutorial/essential/io/writingFiltered.html
    it will show you how to subclass a filtered output stream and add your own formatting methods.Then you can chain your new class to System.out
    like this:
    YourFilteredStream yfs = new YourFilteredStream(System.out); .
    Then:
    yfs.yourNewMethod(); goes directly to system out in the new format.

  • How to set column widths in tables for selected table only, not globally throughout document?

    I've been utilizing the below script (thank you so much Ramkumar. P!) to set column widths throughout a sizable InDesign book with tables on every page and it is truly a time saver. At this point in time, I have three versions of it because there are different column widths throughout the book. Is it possible to augment the script to run only on a selected text frame (containing a table)? If so, would someone be kind enough to share the augmented script with me? I've been trying to figure out this seemingly simple change through trial and error with no success as yet. I realize this is a totally newbie request and I'm entirely at the mercy of the kindness of the Javascript gods that contribute within this forum. Seeing that in a different post related to this script, one such guru responded to a request as simple as "Where do I put the scripts in InDesign" gave me enough courage to ask for some help! Thank you in advance to anyone willing to provide a solution.
      var myDoc = app.activeDocument;
         var myWidths = [100, 100, 150, 150];
         for(var T=0; T < myDoc.textFrames.length; T++){
             for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
                 for(var j=0; j < myWidths.length; j++){
                     myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
         alert("Table width updated successfully...");

    Hello all
    I have the same problem in that I'm not a scripting person, but was able to get the above script working without problem, and it does set irregular table column widths perfectly, so thanks to Ramkumar. P for that.
    BUT, it changes the column width for ALL tables in the document, whereas I would like to just target the selected table.
    Any ideas as to how I might amend this script to achieve this?
    Thx, Christian

  • Question about Setting Window Title/the use of AVWindowSetTitle()

    Hi everyone,
    I have a question about setting the title of the window in which the Acrobat viewer normally opens a PDF file.  The documentation states that AVWindowSetTitle() cannot be used in this case.  However, using it has worked with versions of Acrobat/Reader up until and including version 8.
    Everything breaks down starting with Acrobat 9.
    According to the documentation I am supposed to do the following: "To set the title of a window in which the Acrobat viewer opens a PDF file, you must replace AVDocOpenFromASFileWithParams() and pass the window title in tempTitle."
    Unfortunately, there are 2 problems I have with this approach:
         I do need to be able to change the document title on document Save, not only on document Open
         I do not know what AVDocOpenFromASFileWithParams() implementation has to look like if I have to replace it using HFTReplaceEntry().
    Is there a sample customized implementation of AVDocOpenFromASFileWithParams() somewhere that I could take a look at?
    Is there a way to change a document Title inside Acrobat/Reader window after a Save operation?
    Thanks a million,
      Lana2010K

         I am sorry.  I don't know how you tested this and came to conclusion that this works correctly in Acrobat X.
         I just tested our Acrobat plug-in with a trial version of Acrobat X and this did not work.
         When we open a file in Acrobat (doing it ourselves in the plug-in by adding another specialized open) we set the window title to something different from the default file name.  Then if a file gets edited and saved (File->Save), the window title gets reset to the file name. In the PDDocDidSave callback we call AVWindowSetTitle() to set it back to a more descriptive window title we need.  This has worked up until and including Acrobat 8, but does not work in either version 9.0 or 10.0.
         Also, I just modified the plug-in code to always change the Window Title of every document (even if opened through native File->Open) on document Save.  It does not work.
         Please help,
              Lana2010K

  • Question about setting cookies and custom authentication

    I have a question about setting cookies.
    I have two different 'projects' in HTMLDB - we will call them App1 and App2.
    I also have two different connection configurations setup in the DADs.conf file. - we will call them Connect1 and Connect2.
    App1 is setup to use database authentication (no user is specified in the DAD) and uses Connect1. Once the user successfully logs in, we set a username cookie (this is a persistent connection).
    We created a custom authenticatoin scheme for App2 - this scheme checks for the username cookie (set by App1). We would like for App2 to use Connect2 (HTMLDB_PUBLIC_USER is the default user specified and it uses connection pooling).
    Is it possible to set a cookie from App1, Connect1 for App2, Connect2 - then redirect to App2 and pick up that cookie?
    Here is an example of what we are trying to accomplish:
    A user loggs into App1, we set a cookie, and the user is redirected to App2. If the cookie exists, we allow them access to the home page in App2, if no cookie, we redirect back to a 'Login Failed' page in App1. We don't want App2 to use the same database connection as App1 though, we need App2 to use connection pooling.
    Is this possible? OR...Is there a better way to accomplish what we want to do?
    This is an enhancement to an existing app. Our requirements are to use Database Authentication (setup where pass expires after 60 days or so, cannot reuse last 3 passwords, etc.) - which is already setup and being used by other applications in our organization. All of our users have accounts in the database. We don't want users to have a new username/pass - and we don't want to manage a separate group for HTMLDB apps.
    The existing application uses HTMLDB's built in authentication - which uses database username/pass, and it uses connection pooling, but we cannot handle the pass expire stuff in it, unless there's something we're not seeing or understanding - at least that's how our DBA explained it to us.
    Any help with this will be appreciated so much. I can send you the code we have if needed.
    Thanks!

    Same problem here.  I have so many problems with this remote app.  Is there an iTunes API? I would like to write my own remote app that actually works.

  • How to set column width in alvgrid

    hi
    how to set column width in alvgrid.
    thanks.

    Hi,
    Check this,
    REPORT  ztest.
    DATA: BEGIN OF i_scarr_tab OCCURS 0.
            INCLUDE STRUCTURE  scarr.
    DATA: END OF i_scarr_tab.
    DATA: i_scarr LIKE TABLE OF i_scarr_tab WITH HEADER LINE,
          w_scarr LIKE LINE OF i_scarr_tab.
    DATA: o_grid      TYPE REF TO cl_gui_alv_grid,
          o_container TYPE REF TO cl_gui_custom_container.
    DATA: lt_fcat     TYPE lvc_t_fcat,
          ls_layo     TYPE lvc_s_layo,
          ls_sort     TYPE lvc_s_sort,
          lt_sort     TYPE lvc_t_sort,
          ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    START-OF-SELECTION.
      CALL SCREEN 9000.
    *&      Module  status_9000  OUTPUT
          text
    MODULE status_9000 OUTPUT.
      SET PF-STATUS '9000'.
      SET TITLEBAR '9000'.
    ENDMODULE.                 " status_9000  OUTPUT
    *&      Module  user_command_9000  INPUT
          text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm .
        WHEN 'BACK' OR 'EXIT'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " user_command_9000  INPUT
    *&      Module  init_9000  OUTPUT
          text
    MODULE init_9000 OUTPUT.
      IF o_container IS INITIAL.
        SELECT * FROM scarr INTO CORRESPONDING FIELDS OF TABLE
           i_scarr UP TO 100 ROWS.
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    Create a custom container control for ALV Control
          CREATE OBJECT o_container
              EXPORTING
                  container_name = 'CONTROL'.
    Create a ALV Control
          CREATE OBJECT o_grid
              EXPORTING i_parent = o_container.
          PERFORM build_field_catalgue.
          ls_layo-sel_mode = 'A'.
          CALL METHOD o_grid->set_table_for_first_display
            EXPORTING
              i_save          = 'A'
              i_default       = 'X'
              is_layout       = ls_layo
            CHANGING
              it_outtab       = i_scarr[]
              it_fieldcatalog = lt_fcat
              it_sort         = lt_sort[].
        ENDIF.
      ENDIF.
    ENDMODULE.                 " init_9000  OUTPUT
    *&      Form  build_field_catalgue
          text
    -->  p1        text
    <--  p2        text
    FORM build_field_catalgue .
      DATA: ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-cprog
          i_internal_tabname     = 'I_SCARR_TAB'
          i_structure_name       = 'SCARR'
         i_client_never_display = 'X'
        CHANGING
          ct_fieldcat            = ls_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE 'FCAT Error' TYPE 'I'.
        EXIT.
      ENDIF.
      LOOP AT  ls_fieldcat.
        CLEAR ls_fcat.
        ls_fcat-fieldname = ls_fieldcat-fieldname.     "Fieldname
        ls_fcat-ref_table = ls_fieldcat-tabname.       "DDIC ref struct
        ls_fcat-inttype   = ls_fieldcat-inttype.       "Data type
        ls_fcat-outputlen = ls_fieldcat-outputlen.     "Column width
        ls_fcat-coltext   = ls_fieldcat-seltext_m.     "Column Header
        ls_fcat-seltext   = ls_fieldcat-seltext_m.     "Column Desc
        ls_fcat-ref_field = ls_fieldcat-ref_fieldname. "Reference field
        ls_fcat-ref_table = ls_fieldcat-ref_tabname.   "Reference table
        CASE  ls_fieldcat-fieldname.
          WHEN 'LUGGWEIGHT' OR 'FORCURAM'.
            ls_fcat-edit      = 'X'.
            ls_fcat-do_sum    = 'X'.
          WHEN 'URL'.
            ls_fcat-no_out = 'X'.
          WHEN OTHERS.
            ls_fcat-edit      = ' '.
            ls_fcat-do_sum    = ' '.
        ENDCASE.
        APPEND ls_fcat TO lt_fcat.
      ENDLOOP.
    ENDFORM.                    " build_field_catalgue
    check the programs bcalv_grid*.
    check this link for more detailed example.
    http://www.supinfo-projects.com/fr/2005/alv_display_fr/2/
    Regards
    Sruthi

  • I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the proble

    I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the problem when reopened

    https://forums.adobe.com/message/6219922#6219922
    See if the issue in the thread above helps you to solve your problem.

  • How do I set column widths in read/write rules?

    Hello structure experts,
    I am reading a set of DITA files into a specific FM template format, and there is one detail I cannot get to work properly. It should be possible to define column widths in a table, even if the DITA file does not include that information. But the Structure Application Developer Reference does not give the information on which string to pass to the column widths fm property. Does anyone out there have experience in doing this ?
    Thanks
    Jang

    Got it !!!
    Turned out to be simple, but the info was more or less hidden in the Dev Ref Guide: I had already put the "fm property column widths is value " line in but did not know the syntax for the values. Turns out you need to delimit the values by spaces, not commas. The parser does not give ANY useful information about this, just mentions 'syntax error near somewhere' or completely ignores the values you specify.
    This is how the rule for my DITA properties element now works out:
    element "properties" {
      is fm table element;
      fm property columns value is "3";
      fm property column widths value is "5cm 5cm 6cm";
    It works. I earn 10 points for answering my own question. :-)
    Ciao
    Jang

  • Setting Column Widths Corrupts Spreadsheet

    I'm working with Open XML for the first time and I am astonished at how complicated it is.  The Excel object model was complicated, but it seems simple by comparison.  I'm about ready to give up and look for a different solution, but I'll try posting
    this question here and see if I can get any simple answers. 
    I have an ASP.NET MVC web page and I want to let my user download a spreadsheet with data from the database.  I can get some data to appear in the downloaded spreadsheet, but when I tried to set the column widths in Open XML it started given me file
    validation errors and none of the data appears, and the column widths are not set.  It's just a blank spreadsheet.  This is the error it displays:
    Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
    Replaced Part: /xl/worksheets/sheet.xml part with XML error.  Load error. Line 1, column 211.
    Here is the test code that has only one cell loaded with the value Test 4.  It appears when I don't load the Columns object.  It disappears with this error when I try to load the Columns object.  Here is my code:
    private void CreatePartsTest()
    document = SpreadsheetDocument.Create(moMemoryStream, SpreadsheetDocumentType.Workbook);
    WorkbookPart workbookPart = document.AddWorkbookPart();
    Workbook workbook = new Workbook();
    workbookPart.Workbook = workbook;
    WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>("rIdStyles");
    Stylesheet stylesheet = new Stylesheet();
    workbookStylesPart.Stylesheet = stylesheet;
    WorksheetPart worksheetPart = workbookPart.AddNewPart<WorksheetPart>("TestID");
    Worksheet worksheet = new Worksheet();
    Columns cs = new Columns();
    Column c = new Column()
    Min = (UInt32Value)1U,
    Max = (UInt32Value)1U,
    Width = 44.33203125D,
    CustomWidth = true
    cs.Append(c);
    //worksheetPart.Worksheet.Append(cs);
    worksheet.Append(cs);
    // LoadColumns(ref worksheet, oGridColumns);
    //worksheet.Append(new Columns(new Column() { Min = (uint)1U, Max = (uint)1U, Width = 24 }));
    SheetViews sheetViews = new SheetViews();
    SheetView sheetView = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
    sheetViews.Append(sheetView);
    SheetData sheetData1 = new SheetData();
    Row row1 = new Row() { RowIndex = (UInt32Value)1U };
    sheetData1.Append(row1);
    worksheet.Append(sheetViews);
    worksheet.Append(sheetData1);
    worksheetPart.Worksheet = worksheet;
    Sheet sheet = new Sheet();
    sheet.Name = "Test";
    sheet.SheetId = (uint)1;
    sheet.Id = "TestID";
    Sheets sheets = new Sheets();
    sheets.Append(sheet);
    workbook.Append(sheets);
    //oSpreadSheet.WorkbookPart.Workbook.Save();
    wbPart = document.WorkbookPart;
    MCSD .NET developer in Dallas, Texas

    Here is the test code that has only one cell loaded with the value Test 4.  It appears when I don't load the Columns object.  It disappears with this error when I try to load the Columns object. 
    Hi DallasSteve,
    How did you load the cells and why? Could you please post the details of the method "LoadColumns(ref worksheet, oGridColumns)"?
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • AUTO_RESIZE jtable set column width by column header

    Do I need to use one of the AUTO_RESIZE methods, the TableColumnModel, or another method in order to set the default width for a column based on the width of the column header.

    This is a simple question with an answer. In a JTable, how do you set the width of a column depending on the width of the column header?

  • Setting column widths in a PdfPTable at run time

    My web application is building PDF output using iText. The data is coming from a database through JDBC. At run time I will not know how many columns are being returned and I will not know the relative widths of each column, so I have to set this at run time to make it look good. This is the problem I am having.
    I am calling the data and returning an ArrayList of ArrayLists, each of the internal ArrayLists contains the data and the first one contains the column labels. The labels are going to be longer than the data so I can set the column widths to the labels and it should be fine. But how?
    Here is what I am trying so far, without success.
    ArrayList headRow = (ArrayList) mainList.get(0);
    float[] widths = new float[headRow.size()];
    for(int i=0;i<headRow.size();i++) {
    Chunk chunk = new Chunk((String) headRow.get(i));
    widths[i] = chunk.getWidthPoint();
    PdfPTable table=new PdfPTable(colCount);
    table.setWidthPercentage(100);
    table.setWidths(widths);
    As I said, this is not doing what I need, nor is any variation of this that I have tried. So how do I set the relative widths of the columns when I don't know how many columns I'm going to get back or how wide they need to be?
    Thanks

    It worked fine when I had a JTable associated to my table header.
    Any ideas as to why it no longer works or indeed, solutions?Not too sure if I understand the question or problem. Since when can you disassociate a tableheader from a table (or how can you create a tableheader without a table)?
    ;o)
    V.V.

  • Dynamically setting column width doesn't work all the time

    I wanted to dynamically set the width of a column in a JTable to be half of the width of a another column. This should happen whenever the frame is resized. But somehow I need to tell this twice to Java. If I don't then sometimes the column width isn't set new.
    Is this a Java bug or what?
    public void componentResized(ComponentEvent ce)
         try
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              // Again, or it won't work:
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
         catch(SQLException e)
    }

    Is it possible that your call to
    ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
    is altering the response created by
    ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
    ? Have you tried calling them once but in the other order? Or just calling the "setMaxWidth" call twice and leaving out the second "setMinWidth"?
    Good luck... :)

Maybe you are looking for

  • Attachments Activating Generic Object Services (GOS) in VA41/VA42 at item level

    Hi to All, I'm trying to manage attachments for sales document at item level. I've already read this wonderfull post (Activating Generic Object Services Toolbar in SAP Objects) but I didn't understand how manage attachments at item level. Please, if

  • Are the eMac and the G4 Mac Mini similar enough to...

    use the eMac's tiger upgrade to upgrade my mini to Tiger? I know the other versions of tiger upgrades are specific to the hardware, i.e. powerbook, ibook, imac, ect. But seems to me eMac and the G4 mini are very similar. Possible? thanks ~bill

  • How do I specify an output folder when exporting?

    I am running Adobie Premiere Pro CS5.5. I got to File -> Export -> Media. The "export settings" box appears. I know how to set the settings for my desired export. The issue I'm having is under "summary" where the output is specified. Often, I find my

  • Findstr on 1 file and outputting variables to an outfile

    Hi, I am quite new to the scripting world. I am wondering if you could help me out here. I have a file in a directory (InFile) and would need to compare them to a file similar to what Excel's vlookup is for (CompareFile). Each line in InFile has mult

  • Jre 1.3.1_01 Damaged Download

    I have uninstalled and deleted files and attempted to download and reinstall 4 times. Each time i reboot after every step. I can't seem to get the java plug in to connect properly. This is the error i get when i attemp to log into the host. Java(TM)