Print the values to increment on a single line in the dynamic instruction

How to print an increment of values in a single statement using dynamic sql?

create table test_table (file_id number, start_id number, no_of_id number);

insert into test_table(1, 1000, 3);
insert into test_table (2, 1500, 4);
commit;
I want output like suite to be printed using the dynamic instructions:
redo id 1 bases 1000,1001,1002,1003 ;
redo id 2 bases 1500,1501,1502,1503,1504 ;
I can able to print only to start the number with the following help:
select 'redo id '||file_id||' bases '||start_id||';' from test_table;

o/p is not what i wanted though
redo id 1 bases 1000 ;
redo id 2 bases 1500 ;
Thanks for any help here!

Hello

You can do with plain old SQL static:

WITH     all_ids     AS
(
     SELECT     file_id
     ,     start_id + LEVEL - 1     AS an_id
     FROM     test_table
     CONNECT BY      PRIOR file_id        = file_id
          AND     PRIOR SYS_GUID ()  IS NOT NULL
          AND     LEVEL              <= no_of_id + 1
)
SELECT       'redo id '
       || file_id
       || ' BASES '
       || LISTAGG (an_id, ',') WITHIN GROUP (ORDER BY an_id)
       || ';'       AS out_txt
FROM       all_ids
GROUP BY  file_id
;

Tags: Database

Similar Questions

  • is it possible to print the formulas (and not the values) in numbers

    is it possible to print the tables with formulas (not with values)?

    N °

  • Not able to print the decimal values in a table

    Hi all

    I created an application. Here, I have a table with three columns Col1 and col2 are numbers and col3 is the diffrence between col1, col2.

    I use AJAX and JavaScript to calculate the difference in a dynamic way.

    I am able to print the difference as for example:-1, 2, 1.5-1.5. but not 0.8, 0.8, 0.1 etc...

    If col1 col2 = 1.2 - capable of printing

    If col1 to col2 = 0.2 - error, unexpected token

    error_07012016.PNG

    -Code AJAX:

    Declare  
      p_curr  number;  
      p_prev    number;  
      p_diff number;  
    Begin  
      p_prev    := to_number(apex_application.g_x01);  
      p_curr    := to_number(apex_application.g_x02);  
      
       
      SELECT to_number(p_curr - p_prev) into p_diff  
      from dual;  
      
      -- return calculated value
      sys.htp.p(p_diff);  
    End;
    

    -JavaScript: running the loading of the page

    function f_calulate_duration(pThis) {  
    
      var row_id     = pThis.id.substr(4);  
      var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, ''); 
      var curr       = $(pThis).val().replace(/[^\d.-]/g, ''); 
    
    if(!s){
      var s= 0;
      var prev = s;}
    else{
      var prev = s;}
    
    apex.server.process 
    ( "CALC_DIFF", { x01: prev, x02: curr }, 
    { success: function( pData ) { 
    $('#f23_'+row_id).val(pData);}}
    );  
    }  
    

    Please suggest the solution to this.

    Oracle Apex Version: 4.2.

    Thank you

    Dev

    Hello

    I don't get the point to use the expensive AJAX call to the database, instead you can have the same functionality with JavaScript code below.

    function f_calulate_duration(pThis) {
      var row_id     = pThis.id.substr(4);
      var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, '');
      var curr       = $(pThis).val().replace(/[^\d.-]/g, '');   
    
    if(!s){
      var s= 0;
      var prev = s;}
    else{
      var prev = s;}
    
    var diff = 0;
    diff = curr - prev;
    var n = diff.toFixed(2);
    alert(n);
    $('#f23_'+row_id).val(n);  
    
    //-- Remove this code
    /*apex.server.process
    ( "CALC_DIFF", { x01: prev, x02: curr },
    { success: function( pData ) {
    $('#f23_'+row_id).val(pData);}}
    );*/
    
    }    
    

    Thank you

    D

  • print the value of the variable...

    How to print the value of the variable v_keys using htp.prn in the PLSQL code?

    When I try to print the value of the variable htp.prn (v_keys); his show an error

    wrong number or type of argument in the call tp "PRN".
    v_keys := apex_util.string_to_table(rtrim(:F44973_DEL_KEYS,','),',');
    How to solve this problem?


    SKUD.

    Hello

    Your variable is array and htp.prn input parameter must be varchar2

    Kind regards
    Jari

  • Ability to print the 2 pictures on a single page?

    Is it possible to print several different (shooting) photos on a single page in the print module.  I can't find anything in the help files for LR3.  I know I can do multiples of the same photo, but I want two different shots on a single page.

    Thanks for your help.

    Paula

    In fact, you can drag as many photos as you can on the model. I put

    a model of 19 shots, one a day

    Pre

    Right panel, choose 'Custom Package' and drag your photos from the

    Filmstrip in the model.

    >

  • All the dimension values must be single line values

    I created a Simple hierarchy with the following levels:

    Category
    Subcategory
    Agenda

    The mapping of the hierarchy above is based on a table where the column list are as follows:

    ITEM_KEY
    NOM_ELEMENT
    BRAND_KEY
    BRAND_NAME
    CATEGORY_KEY
    CATEGORY_NAME
    SUBCATEGORY_KEY
    SUBCATEGORY_NAME


    Item_key is the primary key for this table and nom_element is also unique.

    When I maintain this dimension, the following error occurs:


    An error occurred on the server
    Class of error: failure of the Express
    Server error descriptions:
    INI: Error creating a generic Manager definition to < BuildProcess > TxsOqConnection::generic
    INI: XOQ-01600: OLAP DML error "all dimension values must be single line values." while executing DML 'SYS. AWXML! R11_COMPILE_ATTRIBUTES('ITEM.) DIMENSION') ', generic for TxsOqStdFormCommand::execute '.

    at oracle.olapi.data.source.DataProvider.callGeneric (unknown Source)
    at oracle.olapi.data.source.DataProvider.callGeneric (unknown Source)
    at oracle.olapi.data.source.DataProvider.executeBuild (unknown Source)
    to oracle.olap.awm.wizard.awbuild.UBuildWizardHelper$ 1.construct (unknown Source)
    to oracle.olap.awm.ui.SwingWorker$ 2.run (unknown Source)
    at java.lang.Thread.run(Thread.java:595)

    The essential error is "all the dimension values must be unique row values", which means that the server tries to create a dimension of AW member containing a newline character. The error occurs under the SYS. AWXML! Procedure R11_COMPILE_ATTRIBUTES, which is where the attributes are indexed (i.e. transformed into dimension members). If my guess is that one of your attributes (likely mapped to a column _NAME) contains a new line.   The solution is to disable the indexing for that attribute.   In terms of AWM you must make sure the following boxes are not activated in the "Général" pane

  • Create the views level attribute columns
  • Index

  • I need to print the last value

    Hello
    in the Sub statement I need to print the last value
    means last 5555, I can print other values, but last value 5555 is I can't print
    Please help me
    SELECT REGEXP_SUBSTR('5454 4587454 547451 188745 5555','[^'||' '||']+'||' ',1,5)  p1 from dual;
    Thanks in advance
    David

    Karthick_Arp wrote:
    Like this

    with t
    as
    (
    select '5454 4587454 547451 188745 5555' str
    from dual
    )
    select regexp_substr(str, ' [[:digit:]]*$')
    from t
    

    Why leave space in front of her?

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select '5454 4587454 547451 188745 5555' str from dual)
      2  --
      3  select regexp_substr(str, '[0-9]+$')
      4* from t
    SQL> /
    
    REGE
    ----
    5555
    
    SQL>
    
  • not able to print the value of the url (aaa #bbb)

    Hello

    I am not able to print the < cfoutput > #url.xyz # < / cfoutput >

    Here, the url.xyz in the url value is aaa #bbb

    It is printing only aaa

    You should have url-encoded query from the beginning chain. Given that you don't have, Coldfusion ignored everything in the query string that comes after the character #. To fix this, replace the character # % 23. . In other words, .

    Another rule is that we should avoid the occurrence of the character # in a string. Thus, the correct value to cfoutput is "aaa ##bbb". To get and display code that is



    #url_xyz #.

  • convert the column values to a single line...

    I have to return the column values to a single line separated by commas.
    If the nulls in the column just ignore without a comma.
    Here is one for example. There are three values and two NULL values in the table
    SQL> select ID from temp_fa;
    ID
    -----
    
             1
             2
    
             3
    
             5
    
    6 rows selected.
    
    
    I am expecting an output as 1,2,3,5
    Help, please

    There is always more than one title in the Oracle world ;)
    You can use the TRIM, for example (same configuration as your example):

    hoek&XE>  create table t as select level col  from dual connect by level <= 6;
    
    Tabel is aangemaakt.
    
    hoek&XE> update t set col = null where col in (1,3,5);
    
    3 rijen zijn bijgewerkt.
    
    hoek&XE> select * from t;
    
           COL
    ----------
    
             2
    
             4
    
             6
    
    6 rijen zijn geselecteerd.
    
    hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6,,,
    
    1 rij is geselecteerd.
    
    hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6
    
    1 rij is geselecteerd.
    
  • Search for value in the subset of data and returns a single line.

    Hello

    I wonder if you can help me with a query.

    I want to return a single line of data below

    where the Rno = 1 but also include a column to indicate a code of T555 tran was found in the subset (based on customer no)

    I used an analytic function (row_number) to enter the data in the following order and wonder if there is something similar for helping me understand the transaction code.

    Customer without Tran Code TranDate NWR

    1 T345 01/01/2001 1

    1 B455 01/01/1999 2

    1 T555 01/01/1998 3

    1 R433 01/01/1997 4

    1 "T543" 01/01/1996 5

    Thank you


    SQL> with t
      2  as
      3  (
      4  select 1 client_no, 'T345' tran_code, to_date('01/01/2001', 'dd/mm/yyyy') trandate, 1 rno
      5    from dual union all
      6  select 1 client_no, 'B455' tran_code, to_date('01/01/1999', 'dd/mm/yyyy') trandate, 2 rno
      7    from dual union all
      8  select 1 client_no, 'T555' tran_code, to_date('01/01/1998', 'dd/mm/yyyy') trandate, 3 rno
      9    from dual union all
     10  select 1 client_no, 'R433' tran_code, to_date('01/01/1997', 'dd/mm/yyyy') trandate, 4 rno
     11    from dual union all
     12  select 1 client_no, 'T543' tran_code, to_date('01/01/1996', 'dd/mm/yyyy') trandate, 5 rno
     13    from dual
     14  )
     15  select client_no
     16       , tran_code
     17       , trandate
     18       , rno
     19       , case when t555_cnt > 0 then 'YES' else 'NO' end t555
     20    from (
     21            select t.*
     22                 , count(decode(tran_code, 'T555', 1)) over() t555_cnt
     23              from t
     24             where client_no = 1
     25         )
     26   where rno = 1;
    
     CLIENT_NO TRAN TRANDATE         RNO T55
    ---------- ---- --------- ---------- ---
             1 T345 01-JAN-01          1 YES
    
    SQL>
    
  • Print the URL at the top / bottom of page is too small and half out of the page

    I put it to print the URL and the title at the top of the page and the Date at the bottom of the page. He tries to do, but the impression is verrry small and 1/2 off the page.

    Works very well with Google Chrome.

    New printer WF 2540, test page is good.
    Mac 10 X

    Thanks for your help!

    Peter

    The font size of header and footer is still low. Last time I looked, I couldn't find a way to replace the default size of 10 others to choose a font that is intrinsically superior to Times New Roman as your default serif font. See: can I possibly enlarge the headers and footers in the "Page layout" menu of Firefox to make bigger it so I can see it better... or is this something I won't have to deal with being so SMALL. I don't check for a complementary solution; You can try looking for one on the Addons site.

    As the position on the page, some printers don't allow you to get all the way at the edge of the sheet. If that's the problem, you might be able to fix in the General settings of your system for your printer dialog box. I don't see a way to access of the Mac print dialog (Firefox print dialog screenshots in this article: How to print webpages in Firefox), so that you may find in Control Panel.

    If this does not work, there are certain preferences that Firefox stores with names similar to the following. In these environments, 25 = 1/4 inch (the value is divided by 100).

    • Print.printer_BrandX.print_unwriteable_margin_top
    • Print.printer_BrandX.print_edge_top

    To modify these, you can use the subject: configuration preferences editor. In a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful. Then use some of the more unique terms (for example, unwrit or edge) to filter the list.

  • I fill out an application online for the school. Is it possible to configure Firefox to check the spelling in a single-line text box without having to right click each time?

    I want to be able to set the spell checker to occur automatically, even for single-line text boxes.

    You can set the pref layout.spellcheckDefault to 2 on the topic: config page to perform spell checking on line and unique multi line text fields.

    To open the topic: config page, type Subject: config in the address bar (address) and press the 'Enter' key, as you type the url of a Web site to open a Web site.

    If you see a warning then you can confirm that you want to access this page.

    • Use the filter at the top bar of the on: page config to more easily spot a preference.
    • Preferences that have changed see the bold (user set).
    • Preferences you can restore the default value or change via the context menu.
  • Impossible to print the Chinese fonts PCL, always print Korean

    Dear support

    I tried to print the Chinese police of PCL commands

    It prints only Korean, regardless of what font type I attributed

    I've already classified under the code in < esc > (18 < esc > (s1pXXv0s0b17007T

    my printer is M602n, it comes with disk resident fonts Japanese, Korean, Chinese-T, S-Chinese

    Can someone please help?

    Thank you

    I don't have access to a printer LaserJet M602n , so don't know much about his abilities.

    Its replacement by 12 for the point size XX in your skeleton PCL escape sequence:

    < esc > (18         main fonts: symbol Set (18 = Unicode))
    < esc > (s1p main fonts: spacing: proportional)
    12V main fonts: height (12 points)
    0 main fonts: Style (standing, solid)
    0b main fonts: the race weight: medium
    17007T main fonts: font (identifier = 17007)

    shows that you select a font:

    • That supports the 18 (= Unicode) symbol defined. all the evolutionary independent printer encapsulated TrueType fonts resident should theoretically therefore be candidates.
    • Which is proportionally spaced and available in the selected, the size in points.
    • With the font identifier 17007 - I have no idea if it is a printer resident on the M602 template policy.

    However, to select characters with the character codes outside of byte 0 x 20->0xff range using the Unicode code points (need two-bytes or more, because they are larger than 0xff), you must also select the method of text analysis; for Unicode, it would be:

    < esc > & t83P        method of text analysis: UTF-8

    Then the required code points must be specified using the (two bytes or more) coding UTF-8 to Unicode code point values (so, for example, U + 100 would be coded under 0xc480); I don't know, offhand, which extends under Unicode are used for characters in the Chinese language.

    There are other values of the sequence of text analysis Mode to select, but I'm not very familiar with any of them:

    < esc > & t0P   text analysis method: 1 byte
    < esc > & t1P text analysis method: 1 byte
    < esc > & t2P method of text analysis: 2 bytes
    < esc > & t21P method of text analysis: 1 | 2 Asian 7-bit bytes
    < esc > & t31P method of text analysis: 1 | 2 Shift-JIS bytes
    < esc > & t38P method of text analysis: 1 | 2 Asian 8-bit bytes

    that can be used with another Asian symbol fixed (if the printer supports them), but I don't know the details offhand.

  • How can I print the manual?

    It is a question that applies to my two recent purchases of SONY, a SONY kdl60ex720 TV and now a camera SONY DSC-HX100V. How can I print a copy of the users guide? This must been an oversight by SONYS CE Ministère, it is not very difficult to provide an option to print the manual page in its entirety not only one at a time.

    You can use Adobe Acrobat to print all I have manual from the Web site as a single pdf file. You can use the trial version of Acrobat for this work.
    Choose "Create a PDF file from the Web site" and copy the URL. Make sure "load the entire Web site" is selected.

  • I want to print the username in each page using the network printer. To identify which print this page.

    Print the computer name on each page using a network printing

    Dear all,
    Help on this issue. I want to print the username in each page using the network printer. To identify which print this page.

    As much as I know that you can't do this with every printed page, but you can use the separation pages (* .sep) and have this printed on a single page at the beginning of each print job.

    Tip: Put the separator page in the folder % WINDIR%\System32.

    See here: http://support.microsoft.com/kb/102712

    .Sep file is just a text document, the following prints only the user name:

    Name $LUser $N
    $E

    John

Maybe you are looking for

  • The toolbar questions

    I have some problems with the Settings toolbar on my iMac and MacBook Pro. First of all, when I click on the box with an arrow pointing upward (extreme right) to add a bookmark, the link used to be saved in bookmarks. Now it jumps immediately to the

  • External speakers on HP G72-130sa laptop

    I tried to connect Logitech S220 speakers to my laptop via the helmet taken but cannot get any sound. Do I need to do anything on the computer itself (such as drivers, adjust the sound settings etc..).  I was connect the Green wire in the headphone j

  • Configuration of the ACL to restrict access via SSH/Telnet

    You want to shoot a SSH/Telnet access to ISP address/IP of my switch interface.  Since the Dells have no strict vty/con interface to apply an ACL I guess I just have to match on an interface instead.  Using the ACL below.  Problem is that applying it

  • HP omni 200 all-in-one: hp omni 200 display brightness and contrast

    I'm trying to adjust my brightness of the screen to the bottom... I already tried the right buttons... All that I can do?  I need for the low average display brightness to match printable photo of my laboratory.  Also is it possible to change the con

  • error: unable to create initial extent for segment in tablespace ora-01658

    Hellowhile I try to create the table in the apex, his watch an error such as ora-01658 unable to create an initial step to segment in tablespace. I found the solution in net as ORA-01658:Failed to create the INITIAL extent for segment in tablespace s