Alternate for Replicate function of sqlserver

What is the alternate for Replicate function of Sql Server in oracle.

Or, you can create it easily.
SQL> create or replace
  2  function replicate(in_str varchar2,in_int number)
  3  return varchar2
  4  is
  5  p_str varchar2(4000);
  6  begin
  7    p_str := '';
  8    for i in 1..in_int loop
  9      p_str := p_str||in_str;
10    end loop;
11    return p_str;
12  end;
13  /
Function created.
SQL> select replicate('abc',3) from dual;
REPLICATE('ABC',3)
abcabcabc

Similar Messages

  • Alternate for stuff function of sqlserver

    Hi,Can Anyone please help me in migrating following code from sqlserver to oracle.
    set @sLastItemInPkts_2 = Stuff(@sLastItemInPkts_2,
    @iOffset,
    @iElementSize,
    SubString(@sLastItemInPkts_1,
    @iOffset,
    @iElementSize)
    set @sLastItemInPkts_1 = Stuff(@sLastItemInPkts_1,
    @iOffset,
    @iElementSize,
    Convert(varChar(10),
    Replace(Str(@iDocId, @iElementSize),
    0))
    Thanks in advance.

    If we need to replace in a string not a certain sequence of characters, but a specified number of characters, starting from some position, it's simpler to use the STUFF function:
    STUFF ( <character_expression1> , <start> , <length> , <character_expression2> )
    This function replaces a substring with length of length that starts from the start position in the character_expression1 with the character_expression2.

  • Help:alternate for calling function in where clause

    Hi ,
    In below query i'm calling function in where clause to avoid COMPLETE status records,due to this query taking 700 secs to return result.If i'm remove below function condition it's returning results with in 5 secs.Can you some one advice to any alternate idea for this?
    WHERE mark_status != 'COMPLETE'
    SELECT assessment_school,
      subject,
      subject_option,
      lvl,
      component,mark_status,
      mark_status
      NULL AS grade_status,
      NULL AS sample_status,
      :v_year,
      :v_month,
      :v_formated_date,
      :v_type,
      cand_lang
    FROM
      (SELECT assessment_school,
        subject,
        subject_option,
        lvl,
        programme,
        component,
        paper_code,
        cand_lang,
        mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) AS mark_status
      FROM
        (SELECT DISTINCT ccr.assessment_school,
          ccr.subject,
          ccr.subject_option,
          ccr.lvl,
          ccr.programme,
          ccr.language AS cand_lang,
          ccr.paper_code,
          ccr.component
        FROM candidate_component_reg ccr
        WHERE ccr.split_session_year = :v_year
        AND ccr.split_session_month  = :v_month
        AND EXISTS
          (SELECT 1
          FROM IBIS.subject_component sc
          WHERE sc.year          = ccr.split_session_year
          AND sc.month           = ccr.split_session_month
          AND sc.paper_code      = ccr.paper_code
          AND sc.assessment_type = 'INTERNAL'
          AND sc.subject_option NOT LIKE '%self taught%'
          AND sc.component NOT IN ('PERFORMANCE  PRODUCTION','PRESENTATION WORK','REFLECTIVE PROJECT','SPECIAL SYLLABUS INT. ASSESSMENT')
        AND NVL(ccr.withdrawn,'N') = 'N'
        AND ccr.mark_status       != 'COMPLETE'
        AND EXISTS
          (SELECT 1
          FROM school s
          WHERE s.school_code   = ccr.assessment_school
          AND s.training_school = 'N'
    WHERE mark_status != 'COMPLETE';

    One thing you can test quickly is to put the function call in it's own select ...from dual.
    This might make a difference.
    However, only you can check this, I don't have your tables or data.
    So, what happens if you use:
        paper_code,
        cand_lang,
      (select mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) from dual ) AS mark_status
      FROM
        (SELECT DISTINCT ccr.assessment_school,  --<< is the DISTINCT really needed?
          ccr.subject,
          ccr.subject_option,
    ...Also, try to find out the purpose of that above DISTINCT, is it really needed or is there some join missing?

  • Alternate for analytic functions

    Hello All,
    I'm trying to write a query without using analytic functions.
    Using Analytic func,
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE     11.2.0.2.0     Production"
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SELECT id, sal, rank() OVER (PARTITION BY ID ORDER BY SAL) rnk FROM
    (SELECT 10 AS id, 100 AS sal FROM DUAL
        UNION ALL
        SELECT 10, 300 FROM DUAL
        UNION ALL
        SELECT 10, 400 FROM DUAL
        UNION ALL
        SELECT 20, 200 FROM DUAL
        UNION ALL
        SELECT 20, 200 FROM DUAL
        UNION ALL
        SELECT 20, 300 FROM DUAL
        UNION ALL
        SELECT 30, 100 FROM DUAL
        UNION ALL
        SELECT 40, 100 FROM DUAL
        UNION ALL
        SELECT 40, 200 FROM DUAL
        ) Expected results. I want these results without analytic functions.
    10     100     1
    10     300     2
    10     400     3
    20     200     1
    20     200     1
    20     300     3
    30     100     1
    40     100     1
    40     200     2

    Hi,
    SamFisher wrote:
    Thank You Frank. That was simple.
    I was trying to get the reults without using analytical functions. Just trying to improve my SQL skills. Yes, I admit that practicising using the wrong tools can improve your SQL skills, but I think there's a lot to be said for practising using the right tools, too.
    I tried all sort of things. I thought hierarchical query would do it but hard luck for me.Do you want to use a CONNECT BY query for this? Here's one way:
    WITH     got_max_level            AS
         SELECT       id
         ,       sal
         ,       MAX (LEVEL)     AS max_level
         FROM       table_x
         CONNECT BY NOCYCLE  id        = PRIOR id
              AND          sal       >= PRIOR sal
              AND     (   sal       >  PRIOR sal
                   OR  ROWID > PRIOR ROWID
         GROUP BY  id
         ,            sal
    ,     got_cnt          AS
         SELECT       id
         ,       sal
         ,       COUNT (*)     AS cnt
         FROM       table_x
         GROUP BY  id
         ,            sal
    SELECT       x.id
    ,       x.sal
    ,       l.max_level + 1 - c.cnt     AS rnk
    FROM       table_x        x
    JOIN       got_max_level  l  ON   x.id     = l.id
                         AND      x.sal     = l.sal
    JOIN       got_cnt      c  ON      x.id     = c.id
                         AND      x.sal     = c.sal
    ORDER BY  x.id
    ,            x.sal
    ;This is even less efficient, as well as more complicated, than the scalar sub-query solution.

  • Want to replicate services for object functionality in my z- program

    Hi
    I can see the "Services for object functionality" in IW32 transaction. I want to replicate the same functionality for my custom program.
    Please let me know if I can get any pointers for this.
    Regards
    Swetabh

    Hi,
    check out the program of the iw32 tcode.
    then in debugging mode find the code where exactly the requirement is going on with the code of the program.
    then copy that code in your custom program and do the needful changes.
    Regards,
    Venkat n

  • Replicate "Services for object" functionality in Z Program

    Hello All,
    I want to replicate "Services for object" functionality as in ME23N in my Z Program. How do I achieve it.
    Thanking you all in anticipation.
    Regards,
    Anju

    Read this wiki [How to Attach Documents to Any Custom Program Using Generic Object Services|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/0e6b0d95-0a01-0010-4696-ca0a48de5fb3]
    Regards,
    Raymond

  • Replicate services for object functionality in my customised  program

    Hi
    I can see the "Services for object "functionality in ME23N transaction. I want to replicate the same functionality for my custom program.Is there any badi or Function Module .
    Please let me know if I can get any pointers for this.
    Regards
    Deesanth

    hi desanth,
    i am in need of same requirement.
    if you any solution please let me know...........
    thanks,
    krishna

  • BAPI or RFC for replicate the transaction LX03

    Hi experts,
    anyone know any BAPI or RFC for replicate the transaction LX03?
    Thanks

    There are no alternate transaction for OBY6

  • Alternate for Clickstream???  Its Urgent

    Hi,
    Currently I am working in Oracle Application Server 10.1.2.0.2 (Windows 2000- Envirnoment) My recuirement is to capture information about where the users are coming and I want to track their clicks.
    Oracle Clickstream Intelligence is not supporting 10.1.2. Urgently I need to find the alternate for this.
    Thanks in Advance...
    Regard
    Balaji S

    the same functionality is available in oracle warehouse builder, please cross check.

  • Alternate Item Group functionality in BOM

    Hi PP Gurus,
    I was looking into the Alternate Item Group functionality in BOM and found it interesting for my business requirement.\
    But I am facing one problem as below:
    I have 3 components for Eg. A1, A2, A3 in my header material 'A'. All the three component materials are same but quailty of the 3 is different and also the standard price.
    My requirement is whenever I am creating Production material for header material 'TEST_Header_Material, the system should look into A3 first (Cheapest), if not available then A2 (Cheaper) and if not then A 1(expensove of all the three).
    For base quantity for A = 1EA, I have entered 1 EA for A1, A2, A3 in BOM. I have stock of A1=9, A2 = 6 and A3 = 2.
    When I am creating Production Order for A = 10 EA, ,yrequirement is that the system should consider A3 first, then A2 and then A1 based upon the prority and hence should withdraw A3=2, A2=6 and A1=2 for meeting the quantity for finish product A in Production Order. But actuall the system is considering A3 but confirming it as 0, then looking into A2 again confirming it as zero and then looking into A1 and  again confirming it as 0. And thus giving Missing Part list though I have sufficient quantity to cover the requirement.
    That means system is only considering total quanitty.
    Can you please advice?
    Thank You.
    Rahul.

    Dear Rahul,
    Priority:In this field, you define the priority of the item within an alternative item group. This determines the priority for planned
    withdrawal of items. Two items are assigned to an alternative item group (A1) with the following values for priority:
    Item 0060 Value for priority: 02
    Item 0065 Value for priority: 01
    The system reads item 0065 first.
    Also check these links,
    concept of alternative items
    Re: Alternative item in BOM
    Re: NOTE 149332 : Error for material components with usage probability 0
    Re: Discontinuation&Production Order
    Regards
    Mangalraj.S

  • Help - Class name and descriptions for a function location.

    Hi Guys
    i have to write a report that displays the class and class descriptions for a function location. the user passes in either the function location(TPLNR) or the class name and  the report should display the the class characteristics and resp. values. Is there a FM that i coud use?
    please help.
    many thanks.
    seelan.

    sadiepu1 wrote:
    When I set up Words with Friends on my Fire it asked for my username and password which from a previous reply to my inquiry above stated that the S 3 doesn't store due to privacy issues. I have tried all my usual combinations of usernames and passwords and my Fire won't let me access the game as it keeps telling me that one or the other is not correct. I have deleted the app from my Fire and re-downloaded it but have the same error comes up. I have accessed the Words with Friends support both on my phone and their website but there is no live chat. I might have to take both to a Verizon store. Also, my Fire won't let me access the game without a correct username and password. To say that I am frustrated would be an understatement as well I have tried everything I can think of with no luck! Thanks for any help you can give!
    Did you use facebook to log in? 
    Verizon will not be able to help you retrieve any of the information you need.  You will have to contact Zynga.

  • Performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA)

    Hi Friends
    I am having performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA) and one my client got over 8 thousend employees . This function-module taking forever to read the data. is there any other function-module to read the absences data IT2001 .
    I did use like this .if i take out this F.M 'HR_TIM_REPORT_ABSENCE_DATA_INI' its not working other Function-module.please Suggest me .
    call function 'HR_TIM_REPORT_ABSENCE_DATA_INI'
    exporting "Publishing to global memory
    option_string = option_s "string of sel org fields
    trig_string = trig_s "string of req data
    alemp_flag = sw_alemp "all employee req
    infot_flag = space "split per IT neccessary
    sel_modus = sw_apa
    importing
    org_num = fdpos_lines "number of sel org fields
    tables
    fieldtab = fdtab "all org fields
    field_sel = fieldnametab_m. "sel org fields
    To Read all infotypes from Absences type.
    RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.
    central function unit to provide internal tables: abse orgs empl
    call function 'HR_TIM_REPORT_ABSENCE_DATA'
    exporting
    pernr = pernr-pernr
    begda = pn-begda
    endda = pn-endda
    IMPORTING
    SUBRC = SUBRC_RTA
    tables
    absences = absences_01
    org_fields = orgs
    emp_fields = empl
    REFTAB =
    APLTAB =
    awart_sel_p = awart_s[]
    awart_sel_a = awart_s[]
    abstp_sel = abstp_s[]
    i0000 = p0000
    i0001 = p0001
    i0002 = p0002
    i0007 = p0007
    i2001 = p2001
    i2002 = p2002
    i2003 = p2003.
    Thanks & Regards
    Reddy

    guessing will not help you much, check with SE30 to get a better insight
    SE30
    The ABAP Runtime Trace (SE30) -  Quick and Easy
    what is the total time, what are the Top 10 in the hitlist.
    Siegfried

  • How to check for a function module with its description and functionality

    Hi all,
    How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .

    Hi,
    You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
    Say for example you need to search something regarding converstion.
    Search for * CONVERT * and press F4.
    If there is something specfic like converting date to something you can give
    DATE * CONVERT *
    OR
    CONVERT * DATE *  and press F4.
    Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
    Regards,
    Pramod

  • Required to get class Charateristics and values for an functional location

    Hi ,
       As per the requirement ,i have to read the class characteristics and the corresponding values for an function location.I have functional location number ,and the various class names associated with fn.location. Any pointers would be helpful
    Regards
    Arun T

    FM BAPI_OBJCL_GETDETAIL
    OBJECTKEY                       ?0100000000000011643
    OBJECTTABLE                     IFLOT              
    CLASSNUM                        ZPMI_BLDG          
    CLASSTYPE                       003                
    KEYDATE                         29.07.2009         
    UNVALUATED_CHARS                                   
    LANGUAGE                        EN                 
    Cheers!

  • How to register a jsp page for a function

    Hi,
    Im new to OA Framework. I have to load a custom jsp page on clicking a function under a responsibility. I logged into "System Administrator" resposibility -->Application --> function. Searched for the function and in the Web HTML set the value as "/OA_HTML/testPage.jsp" (I tried "testPage.jsp" also)
    I have created the testPage under WebContent directory(in JDeveloper), where all the other jsp pages like, OA.jsp, RF.jsp are found. When i run the test_fwktutorial.jsp and click the function, it gets forwarded to Login Page.
    Whr am i going wrong..any ideas.
    Thanks,
    Vishnupriya

    OAJSPHelper class is a helper class which contain lot of static methods to get context related data, this class should would have values after webappscontext is initialized,ie. you are moving from a OAF page to a jsp page.
    If you wanna open your jsp directly and create apps session, you need to hard code values of password, username ,responsibility bkey etc to create webappscontext. In case of fwktutorial jsp from where you might have picked this code, these properties are picked from text file in OA_html folder in jdev.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Quicktime will not load Apple iPhone OS4 Keynote from Safari

    (iMac) I have been trying to watch the OS4 keynote off the apple website for a few days now. When i press watch it loads up quicktime and all i get is a white background with a quicktime logo with a loading dotted bar at the bottom. It does this with

  • SpaceFM - A Customizable File Manager

    This thread is a continuation of the spacefm comments at the end of the PCManFM-Mod thread.  For users of other distros to see more of your ideas, please consider posting to my blog or the SpaceFM Forum as well.  Thanks for all the constructive feedb

  • Upgrade window 2003 to Window 2008 R2 approach (Moss 2007)

    I have moss 2007 running window 2003 32 bit (1wfe and 1sql server). There quite a few customization that i dont know about. I need to move it to Window 2008 R2 or higher. Anyone have done this? I need a good approach with less risk and impact. I'll b

  • Screen Layout for Purchase Orders

    Hello, Using the screen layout settings in config, I want to set a particular field to display only in change mode in ME22N. But enjoy PO's are all controlled by entry ME21N only in config, So this means if I set AKTV (change) to display in ME21N tra

  • Synchronisation for E 63 ????

    what is meant by synchronisation ? what are the advantages of this option to the user? plz reply soon.,