SELECT columns and OUTPUT pad with chars.

Hi,
I need to select a column from a table where if it is of length=16 or less, I will output with '0' behind the string to a total of 19 chars fixed.
Eg. the column contains '1122334455', i will output as '1122334455000000000'
Thanks in advance.
regards,
Tony

Hi,
Using a predicate to test the length of your string (where your_col <= 16) might give you problems selecting the data.
It is genarally best to put code which alters the presentation of the data in the select list if you can, so the following is more flexible and doesn't impact the rest of your query.
  1  select str
  2       , length(str) as len
  3       , case when length(str)<=16 then rpad(str, 19, '0')
  4              else str end as padded
  5* from t
SQL> /
STR                         LEN PADDED
thisisshort                  11 thisisshort00000000
thisisalotlonger             16 thisisalotlonger000
thisisverymuchlonger         20 thisisverymuchlonger
3 rows selected.

Similar Messages

  • Selection Screen and Output

    Hi,
    I am developing one report. My customer is requested me he needs Selection-screen and Output of the report both need in the same screen i.e upper part is selection screen below is the Output..
    Is it possible?
    If  YES could you please help me..........?
    Thank you advance.......

    Hi Kishore,
                   It is possible create the upper block using selection-screen this will be screen 1.Then create the another block and use INCLUDE to include the upper block.Hope your query resolves.
    An example to create selection-screen.
    SELECTION-SCREEN BEGIN OF BLOCK SEL1 WITH FRAME TITLE TIT1.
      PARAMETERS: CITYFR LIKE SPFLI-CITYFROM,
    CITYTO LIKE SPFLI-CITYTO.
    SELECTION-SCREEN END OF BLOCK SEL1.
    SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
      SELECTION-SCREEN INCLUDE BLOCKS SEL1.
      SELECTION-SCREEN BEGIN OF BLOCK SEL2
    WITH FRAME TITLE TIT2.
        PARAMETERS: AIRPFR LIKE SPFLI-AIRPFROM,
    AIRPTO LIKE SPFLI-AIRPTO.
      SELECTION-SCREEN END OF BLOCK SEL2.
    SELECTION-SCREEN END OF SCREEN 500.
    We can use loop at screen to make it active or inactive at user command.That is enter or F8 whatever user chooses.
    Have a best day ahead.

  • In organizer i select photo and click edit with PE, PE opens but the photo is not opened

    in organizer i select photo and click edit with PE, PE opens but the photo is not opened

    In PSE 11 or 12 simply select a thumbnail and click the editor button at the bottom of Organizer.
    In older versions click:
    Fix >> Full Photo Edit

  • Access Web Database - Select record and make report with all associated records

    Hey everyone,
    Right now I'm in the middle of trying to convert an Access client database to be web compatible and I'm running into some problems. For this question, I think I may need to explain a little bit about the database:
    The database I'm making is designed to store information about music rights for different songs. The users can input information about writers, producers, organizations, properties, businesses - which is stored all in different related tables. Then, when a
    user inputs a song, they choose which writers, produces, organizations, etc. are affiliated with that song. 
    What I'm trying to do is make a report where you can choose a writer from the list of all the writers and then produce a report with all of the songs by that writer. 
    I was able to do this in the Access client by making a report that, when opened would trigger (using the On Open event) a form to open where you would choose a writer from a combo box and then click a button. When the button was clicked, it would use the value
    in the combo box in a query, which would find all of the songs by that writer and then open up the report which would have the writer and all of their songs on it. 
    Because web reports don't have many event options and web queries are very limited, I have not found a way to make this report.
    Any help at all would be greatly appreciated!

    Hi,
    I found that you've cross post the quesion on our Answer forum, are you satisfiled the reply from there?
    http://answers.microsoft.com/en-us/office/forum/office_2010-access/web-database-select-record-and-make-report-with/04ce4e25-a964-4146-9a34-f9cb26bb0496
    Regards,
    George Zhao
    TechNet Community Support

  • Cannot delete email.  Selected edit. Selected email and red circle with white check appears.  BUT, options at bottom of screen do not appear.  Help.

    Cannot delete email.  Selected edit.  Selected email and red circle with white check apprears.  BUT, options at borrom of screen DO NOT APPEAR.  I just get a grey band across he bottom of the screen.

    Correction: the "Move" button is blue, not green.

  • Can I use an apple keyboard and track pad with my iPad Air?

    How do I use my apple keyboard and track pad with my iPad Air?

    I did all that you suggest before and it didn't work.  So I waited a bit and tried again and it finally worked.  Not sure what the problem was as I didn't do anything differently.
    Thank you for all your help.

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • Read one column and output its second column value in same row

    Hi
    I have 2 columns, of which I only wish to read the first column. There is an input value, which comes from an outside source, but we can call a constant for this particular question. This constant value must be compared to these first column values, untill it equals the same value. The code must then read the second columns value in the same row and output this value. The exel spreadsheet is below as an example, though the sheet has far more values and larger numbers.
    If there is no value in the first column which is equal to the input constant, it must output a 0. If anyone could help with this it would be fantastic. I'm still busy working on it and might get it eventually, but I would like to get there faster a great deal.
    Thanks
    Jingles
    Attachments:
    Exel.JPG ‏35 KB

    Jingles,
    if you get the data in a 2d array, you should be able to write soemthing like this pseudocode:
    while i<max length
        if checkvalue=array[1,i]
          output array[2,i]
    i++
    if output is empty output zero
    Regards,
    Kyle Mozdzyn
    Applications Engineering
    National Instruments
    Regards,
    Kyle M.
    Applications Engineering
    National Instruments

  • Dynamic gallery with 3 columns and 5 rows with paging

    guyz, i am new to spry and i need your help. i want to create
    a dynamic gallery with data source as xml. i want to create a
    gallery with 3 columns and 5 rows.Basically a wallpaper page where
    there would be 15 wallpapers in a page with a link of downloading
    wallpapers with resolution 800x600,1024x768 and 1280x1024.
    for example if there are 63 wallpapers for a section , then
    there would be 5 pages with 5th page having only 3 wallpapers.
    everytime a wallpaper is added to xml, it automatically adds
    it up in html...
    plz help....i really want to create this asap and i cant find
    any help...

    thanks a ton for your response.... Meanwhile i figured out
    the solution myself using photogallery tutorial where div fixes the
    width and the next repeated element get shifted to another
    line.....
    now i am struck with another problem.
    i need to give substring to a particular data on xml.
    for example i have the following xml
    <movies>
    <data>
    Important Note: These online forums are for user-to-user
    discussions of Adobe products, and are not an official customer
    support channel for Adobe. If you require direct assistance, or
    prefer to contact Adobe support staff directly, please contact
    Adobe support.
    </data>
    </movies>
    i want to display only first 50 characters of data tag.....
    whats the code/syntax to do so.....

  • How to call a SP with dynamic columns and output results into a .csv file via SSIS

    hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
    days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
    Right now, on SSMS, I am able to execute this SP when supplying  a parameter.  What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server. 
    SFTP part is kinda easy as I can call WinSCP with proper script to handle it.  How to export the result of a dynamic SP to a .CSV file? 
    I've tried
    EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ]  @dateFrom = ''2014-01-21''"   queryout  "c:\path\xxxx.dat" -T -c'
    SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
    any ideas?
    thanks
    Hui
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

    Hey Jakub, thanks and I did see the #temp table issue in our 2008R2.  I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
    a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
    to a file destination which is .csv.  
     The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
    and I can live with that at this moment. 
    Thanks
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

  • Select Max and ResultSet Problem With Access

    The following code is producing a 'null pointer excepetion' error and I know why it is occurring I just do not know how to fix the problem.
    Basically I want to automitically generate a unique ID that is one number higher than the max ID (data is stored within an Access database). The ID field is made up of first and last initial taken from parsing previous login info ('JS-01', 'JS-02', ect.). If there are no IDs in the database that match your login info I want to set the new ID equal to 'JS-01' if your login is 'James Smith' for example.
    The problem is explained within the code below.
    <%
    //define resultset and statement
    ResultSet rss=null;
    ResultSet rs=null;
    Statement stmt=null;
    //HERE IS WHERE YOU PARSE THE LOGIN INFO
    String finitial = (String)session.getAttribute("vfirst");//vfirst=JIM
    String linitial = (String)session.getAttribute("vlast");//vlast=SMITH
    char f = finitial.charAt(0);
    char n = linitial.charAt(0);
    String sID = f+""+n;//NOW sID CONTAINS 'JS'
    try {
    //Using the current database connection create a statement
    stmt=con.createStatement();
    //QUERY TO SELECT MAX ID
    //NOTE: CURRENTLY THERE ARE NO IDs LIKE 'JS' IN THE DATABASE !!!!!!
    String sql="SELECT Max(ID) As MaxID FROM tblError Where ID LIKE '%"+sID+"%'" ;
    rs = stmt.executeQuery(sql);
    String newID;
    //HERE THE RESULT SET SHOULD BE NULL BUT IT IS NOT. I KNOW THIS BECAUSE WHEN I REPLACE String iID WITH A LITERAL LIKE 'JS-03' THE LOGIC WILL EXECUTE CORRECTLY AND GIVE ME 'JS-04'. IF I LEAVE THE CODE LIKE IT IS THEN I GET THE NULL POINTER VALUE ERROR BECAUSE YOU CANNOT RESOLVE "MaxID" WHEN THE RESULT SET IS NULL. IF THE RESULT SET IS NULL IT SHOULD NOT EVEN EXECUTE ANY OF THIS CODE WITHIN THE 'if' STATEMENT, BUT IT IS. SO BASICALLY JSP IS LEAVING ME WITH A MAJOR OXYMORON AND I WOULD APPRECIATE ANY ADVICE THAT WOULD HELP ME SOLVE THIS PROBLEM.
    if(rs.next()){
    String iID = rs.getString("MaxID");
    String letters = iID.substring(0,3);
    int numbers = Integer.parseInt(iID.substring(3,5));
    numbers = numbers + 1;
    if(numbers < 10){
    newID = letters + "0" + numbers;}
    else{
    newID = letters + numbers;
    else{//IF THERE IS NO RESULT SET THAN THE ID SHOULD BE 'JS-01'
    newID = sID + "-01";
    %>
    Because this an Access database I cannot use any null exception functions such as NVL or COALESCE which are specific to Oracle and SQL Server I beleive.

    The max() will return a result set, even if the max value is null.
    You should check to see if iID is null.
    if(rs.next())
       String iID = rs.getString("MaxID");
       if (iID == null)
           newID = sID + "-01";
       else
          String letters = iID.substring(0,3);
          ... etc ...
    }

  • How to list selected parent and child rows with values from ADF TreeTable

    I created one tree table having three levels using DepartmentsVO, EmployeesVO and
    JobHistoryVO where these tables contains parent and child relationship on database.
    Then i added one more column to the tree table which displays selectBooleanCheckBox. This
    check box is available for parent and child rows in that column.
    My first concern is i
    want to list out all the parentids and its child ids from three levels where the check
    box is selected.
    second concern is
    if i select the check box for a parent row, then the remaining check boxes for child rows also select automatically which are comes under the parent row.
    Thanks in advance.
    jk

    hi Frank,
    Thanks for the quick reply...
    As I mentioned before I am able to get the children using JUCtrlHierNodeBinding. but wanted to change the value of child row which have specific data.
    Is it possible through JUCtrlHierNodeBinding to update data of child and parent?? If so then can you please post the code snippet for the same???
    Viral

  • Input with sql*plus and Output it with PL/SQL

    Hi everyone,
    I try to understand how can I get input and input by using sqlplus and plsql together. I get output like this:
    Get User Input
    Given Name: Iron
    Family Name: Man
    old   6:        Given_Name := '&GivenName';
    new   6:        Given_Name := 'Iron';
    old   7:        Family_Name := '&FamilyName';
    new   7:        Family_Name := 'Man';
    Given Name: Iron
    Family Name: Man
    PL/SQL procedure successfully completed.My Codes:
    PROMPT Get User Input
    ACCEPT GivenName PROMPT "Given Name: "
    ACCEPT FamilyName PROMPT "Family Name: "
    DECLARE
         Family_Name Varchar(15);
         Given_Name Varchar(15);
    BEGIN
         Given_Name := '&GivenName';
         Family_Name := '&FamilyName';
         DBMS_OUTPUT.PUT_LINE('Given Name: ' || Given_Name); 
         DBMS_OUTPUT.PUT_LINE('Family Name: ' || Family_Name);
    END;
    /My question is why I get
    old   6:        Given_Name := '&GivenName';
    new   6:        Given_Name := 'Iron';
    old   7:        Family_Name := '&FamilyName';
    new   7:        Family_Name := 'Man';this bit?Is there something wrong in my code? Thanks.

    Hi,
    From SQL*Plus reference:
    After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
    So. you can remove current output with
    SET VERIFY OFF
    and enable your PL/SQL output by
    SET SERVEROUTPUT ON
    Regards
    Peter

  • Selecting textframe and text inside with 3 clicks

    This was possible in InDesign-Versions previous to InDesign CC. Now, if I double-click a textframe i have to wait 1 second, then i'm able to select text with another double click.
    That is very annoying and disturbs my working process. Is someone else facing this issue?
    The answer from the Adobe LiveChat-Support was "we have something changed" and questions in the kind of "First: Have you already turned your machine on?".
    Friendly as they are the gave me an mysterious adress to a cave somewhere in US, where I can dig for further answers. Fine.

    Sorry, that is not my point, changing settings as you propose doesn't solve my problem.
    This triple click is meant if the cursor is already blinking in the selected textframe.
    @Peter Spier: I change nothing in my prefs. Thats how it works since I installed InDesign CC without any changes.
    No matter how often I click once - InDesign CC does not select text. I have to wait one second and then I have to double click, or triple click to select a word or a line.
    I older versions it was possible just to click three times and text was selected - without switchen first to the text-tool.
    I work very fast on an InDesign-Document, often image-frames and text-frames step by step. So it slows me down if I have to wait one second so I'm able to select text...
    I try this explanation, so you can reproduce the error:
    1. create a text frame and enter some text
    2. Switch from text-tool to the selection-tool (Key "V" or Escape-Key)
    3. Click several times (i mean 10 times and more) fast on a word in the textframe. You will see that in InDesign CC no text will be selected. You have to wait 1 second, then the text-tool will be activated and then you are able to select text. I previous InDesign versions after 3 clicks there was text selected - without selecting first the text-tool.
    Understand my problem? In a fast workflow it is unacceptable to wait 1 second because of a UI-Bug...

  • Multiple Columns and List Order with Color

    I am trying to take this code and enhance it by:
    1. It currently displays the output in a 5 column vertical format
    output1 output2 output3...
    I want it to display in a scrolling 5 column vertical format
    output1  output4
    output2  output5
    output3  output6
    based on the number of data points
    2. I want the first column background to be blue, the next white, the next blue, the next white, the last blue.
    Any way to accomplish this..appreciate any help.
    Leo
    Code:
    <table width="100%" border="0" cellpadding="7" cellspacing="0">
    <tr>
    <td colspan="5" align="left" valign="top" bgcolor="#CC6699">
    <span class="datetextwhite"><a name="THURSDAY"> </a><span class="style6">Thursday, October 29th: PRE-CONFERENCE INTENSIVES</span></span></td>
    </tr>
         <TR>
         <CFOUTPUT QUERY="q_daysschedule">
              <TD valign=top><span class="bodytextbold"><span class="style16"><font face="Verdana, Arial, Helvetica, sans-serif">#q_daysschedule.time#</font></span></span><br /><span class="topNavigationBar"><a href="session.cfm?ID=201" class="topNavigationBar">#q_daysschedule.Title#</a></span></TD>
              <CFIF q_daysschedule.CurrentRow MOD 5 IS 0>
                   </TR>
                   <TR></TR>
              </CFIF>
         </CFOUTPUT>
    <tr>

    I find these problems easier to solve if I rearrange my data into an array.  Something like this:
    DataArray = ArrayNew(2);
    Cols = 5;
    Outputs = "output1,output2,etc";
    Rows = Round(ListLen(Outputs) / Cols + .5);    // 32 outputs would give you 7 rows
    for (ii = 1; ii lt cols; ii = ii + 1) {
    for (j = 1; j lte Rows; j = j + 1) {
    DataArray[ii][j] = ListFirst(Outputs);
    Outputs = ListRestOutputs;
    } // rows
    }  // cols
    // Last Column
    for (ii = 1; ii lte ListLen(Outputs); ii = ii + 1 )
    DataArray[cols][ii] = ListGetAt(outputs, ii);
    // put spaces in blank rows
    for (j = ii; j lte rows; j = j + 1)
    DataArray[cols][j] = " ";
    Output like this
    <cfoutput>
    <cfloop from = "1" to = cols index = "ThisRow">
    <cfloop from = "1" to = rows index = "ThisCol">
    #DataArray[ThisCol][ThisRow]#
    closing tags, formatting etc

Maybe you are looking for

  • Flash not working for one user, but not another on this CPU

    Hi, For user A on my computer most video will play in Safari, Firefox, and Chrome. But video at nfl.com will not play. The ads will play but not the actual feature. I just found out that the videos on nfl.com will work for user B. I have rerun the Ad

  • Will this HDD work in my iMac?

    I have an iMac at home that recently gave up the ghost. I believe the HDD died. The screen went to the flashing ? folder and when i tried using disk utility, it would not show the Macintosh HD. The only thing that showed up in the disk utility was th

  • SWF is not loading in Google Chrome browser.

    Hello, My project is developed in adobe flash builder which used sdk 4.0. But from last few month it creates one problem with Google Chrome browser. Some times swf which reside in my .aspx page is not loading and i am getting white background in swf.

  • Help converting a driver to version 6.1

    The instrument driver network has a Keithley 220 driver for LabVIEW 7.0/8.0 but I have version 6.1. I attached the driver to this message. Is it possible to convert it so it will work with version 6.1? Thanks for any help. I could use a driver for th

  • SQLdeveloper on mac and code insight

    Hi! Just downloaded SQL developer 2.1.0.63 and running it on snow leopard. (BTW, for others out there, make sure that you unzip the file with the standard apple utility). I cannot get code insight to work for an Oracle or a Teradata DB. For Oracle, i