How to do it? Need help in syntax - new to Oracle syntax

create or replace
PROCEDURE "SP_SAMPLE_data" (prodName in VARCHAR2) AS
where_criteria char(100);
BEGIN
if prodName = 'A' then
I want to build the where criteria string as “product_name in (‘iPod’,’iPad’)”
else
I want to build the where criteria string as “product_name = directly read from the passed variable(prodName)”
end if;
select *
from “MySchema”.”MyTable”
where where_criteria concatenated here – do not know how to concatenate;
END SP_SAMPLE_data;
New to Oracle PL/SQL syntax.
Oracle 10gR2

You could try someting like this
create or replace procedure SP_SAMPLE_data (prodName in VARCHAR2) AS
   where_criteria char(100);
   sql_stmt varchar2(1000);
BEGIN
   if prodName = 'A' then
      -- I want to build the where criteria string as "product_name in ('iPod','iPad')"
      where_criteria := 'product_name in (''iPod'',''iPad'')';
   else
      -- I want to build the where criteria string as
      -- "product_name = directly read from the passed variable(prodName)"
      where_criteria := 'product_name = '''||prodName||'''';
  end if;
  sql_stmt := 'select * from MySchema.MyTable'||where_criteria;
END SP_SAMPLE_data;I added SQL_STMT variable as I am not sure what do you want to do with SQL statement once it is created. Do you plan to execute it in the procedure or pass it back to the calling environment? If you need to pass it back, then specify SQL_STMT as out parameter.

Similar Messages

  • Need Help to create new screen for RF Sapconsole

    Hi Guru's
    I'm new on RF (but some years in ABAP) since last week.
    I need help to create new screens for RF (SAPLLMOB).
    Can someone explain me the procedure to create screen (with ABAP code after) or perhaps someone have an exemple (simple or not) ?
    I have to develop 2 new screens with really few time.
    And, another subsidiary question :
    how SAP can transfert information between the flash gun and the screen i have developped.
    Is there some code to add to enable this functionality or it is include in SAPLLMOB on standard fields ????
    It's a new strange world for me today...
    Many thanks to everyone who can explain me
    Alain

    hi,
    I am facing this problem as well. Is there any reference to create the new screen?
    Hope someone can help! Thanks!
    Regards,
    Darren

  • I need help making a new Arch install ISO

    I have posted a couple of messages, but as yet no one seems to have responded, probably because they have not read them.
    I need help building a new ISO for Arch, to take account of dmraid.
    I can and have built ones that get so far, and clearly I am not that far away.
    All I need help with now is getting at the contents of the initial ramdisk (/isolinux/initrd.img) so I can make a new one with modifications, and if anyone can help, I need a hand working out how to use the kernel26.img that I will end up with on a system.
    Any help appreaciated.

    As far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.

  • I need help synching my new ipod

    I need help synching my new ipod.  My previous ipod went thru the washing machine so I bought a new device.  I'm having toruble synching the new ipod to my computer

    Hi gvzabcdefg,
    Thanks for visiting Apple Support Communities.
    See this article for the steps to set up your new iPod to sync:
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/PH12313
    Best Regards,
    Jeremy

  • How to link a search help to a parameter using which syntax

    hi
    how to link a search help to a parameter using which syntax

    Hi
    by useing this <b>F4IF_INT_TABLE_VALUE_REQUEST</b> you can creat a search help for a parameter on the screen
    under <b>AT SELCTION-SCREEN ON FIELD</b>
    write a selct query and store that values in the internal table and call that internal table in that FM
    <b>example</b>
    TYPES : BEGIN OF ST_OBJID_SH,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
            END OF ST_OBJID_SH.
    DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
    DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.
    *  IF S_OBJID IS NOT INITIAL.
        SELECT OTYPE OBJID FROM HRP1000
                     INTO TABLE IT_OBJID_SH
                     WHERE OTYPE = 'D'.
    IF SY-SUBRC EQ 0.
    * SEARCH HELP FOR QUALIFICATION.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
    *              DDIC_STRUCTURE         = ' '
            RETFIELD               =  'OBJID'
    *              PVALKEY                = ' '
           DYNPPROG               = SY-REPID
           DYNPNR                 = SY-DYNNR
           DYNPROFIELD            = 'S_OBJID'
    *              STEPL                  = 0
    *              WINDOW_TITLE           =
    *              VALUE                  = ' '
           VALUE_ORG              = 'S'
    *              MULTIPLE_CHOICE        = ' '
    *              DISPLAY                = ' '
    *              CALLBACK_PROGRAM       = ' '
    *              CALLBACK_FORM          = ' '
    *              MARK_TAB               =
    *            IMPORTING
    *              USER_RESET             =
          TABLES
            VALUE_TAB              =  IT_OBJID_SH
    *              FIELD_TAB              =
    *              RETURN_TAB             = RETURN_TAB
    *              DYNPFLD_MAPPING        =
    *            EXCEPTIONS
    *              PARAMETER_ERROR        = 1
    *              NO_VALUES_FOUND        = 2
    *              OTHERS                 = 3
        IF SY-SUBRC <> 0.
    *           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    <b>Reward if usefull</b>

  • Need help with Thin JDBC connecting Oracle to SQL server.

    I am fairly new to JAVA. We have ORACLE 8.1.7 running on Solaris 8. I have a need to
    periodically extract data from ORACLE DB and transfer it to SQL Server. I am limited to
    moving data from the ORACLE/UNIX environment to SQL Server side.
    From what I have read, Server-side Thin driver should work.
    1) Are there any issues in trying to achieve this with ORACLE running on the UNIX platform?
    2) Will the Server-side Thin driver talk to both the DBs ?
    3) Is it possible to provide some sample code ?
    Thanks in advance,
    Solomon

    Quattro,
    I had complete success in reading from Oracle and writing to SQL Server. First of all let me thank you for all your help. I do have one last request. Its more on optimization than any thing else.
    I was trying to optimize my code by grouping both the connections in one place and to keep my reads and inserts together so that I don't commit at the end of each insert etc. I don't seem to have the scope rules under control yet. Could you suggest how to improve this:
    import java.sql.*;
    public class Test_Combined2 {
    public static void main(String args[]) throws SQLException {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Connect to the database
    // You must put a database name after the @ sign in the connection URL.
    // You can use either the fully specified SQL*net syntax or a short cut
    // syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
    Connection con2 = DriverManager.getConnection ("jdbc:oracle:thin:@Test:1521:PSDEVElOP",
    "SOLOMON","SOL1");
    // Create a Statement
    Statement stmt2 = con2.createStatement ();
    String url = "jdbc:microsoft:sqlserver://INTRADEV:1433;DatabaseName=Measure";
    Connection con;
    String query = "select dataYear, dataMonth, yieldRate from tblYield " ;
    Statement stmt;
    try {
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.print(e.getMessage());
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt2.executeQuery ("select year_start, monthofyear, percent_comp " +
    " from ps_usm_ytd_yield ");
    // Iterate through the result and print the employee names
    while (rset.next ()) {
    System.out.println (rset.getFloat (3));
    int ps_dataYear = rset.getInt(1);
    int ps_dataMonth = rset.getInt(2);
    float ps_yieldRate = rset.getFloat(3);
    try{
    con = DriverManager.getConnection (url, "tmpuser","tmppush");
    stmt = con.createStatement();
    PreparedStatement insertTblYield;
    String insertString = "insert into tblYield " +
    " values(?, ?, ?)";
    //con.setAutoCommit(false);
    insertTblYield = con.prepareStatement(insertString);
    insertTblYield.setInt(1, ps_dataYear);
    insertTblYield.setInt(2, ps_dataMonth);
    insertTblYield.setFloat(3, ps_yieldRate);
    insertTblYield.executeUpdate();
    con.commit();
    //con.setAutoCommit(false);
    /*ResultSet rs = stmt.executeQuery(query);
    System.out.println("dataYear, dataMonth, yieldRate");
    while (rs.next()) {
    int dataYear = rs.getInt(1);
    int dataMonth = rs.getInt(2);
    float yieldRate = rs.getFloat(3);
    System.out.println(" " + dataYear + ", " + dataMonth + ", " + yieldRate);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.print("SQLException: ");
    System.err.println(ex.getMessage());
    } //while
    stmt2.close();
    con2.close();

  • I need help with my new ipod on windows me

    I bought myself an ipod in the states (usa) i was told it was universal & can be used in the uk! i have windows ME & was also told this would be compatible with this computer but once i tried to download my software of the cd & put in my details of the ipod it came up with the following error message:ERROR 1904.MODULEC:\PROGRAM FILES\IPOD\IPOD UPDATER 2005-02-07\IPOD UPDATER EXT.Dll FAIIED TO REGISTER .HRESULT-2147220473 CONTACT YOUR SUPPORT PERSONELL.
    can any one help????
    aslo i was told once downloaded onto my p.c i then cant use my ipod on another p.c this does not make any sense say if you upgrade your p.c does this mean you then cant use your ipod anymore ??? please help me ???

    Hello Andrew,
    Was the reply I gave you in the other post you made of no help?
    I explained that Windows ME is not compatible, but you can get it work with a little messing around, and once again, here's a link on how to do it.
    Guide to iPod and Windows ME.
    As I said previously though, you won't be able to use iTunes.
    See my other answer to you here.
    Jeff Bryan, "Need help with my iPod." #4, 06:13am Aug 8, 2005 CDT

  • Computer crashed - lost itunes - need help synching to new computer

    Hi,
    Well last night I was the lucky recipient of a virus...on my old Desktop computer. After battling it for 2.5 hours I had to give up, it basically doesn't work anymore. This was the computer that I've always had itunes on, and the one that I sync both my iPhone 3Gs and iPod with.
    Can someone please tell me:
    a)Once I install iTunes on my new laptop, will it give me issues when I try to resync my ipod? Luckily I have the music backed up on an external hard drive. But will it allow me to sync?
    b)how can I sync my iphone to the new computer/iTunes, without losing all my apps and pictures? Everything was backed up on my OLD computer and therefore lost.
    Please help - it totally ***** and I've never had to move stuff over before.

    Try a search as this is asked almost daily. Easier to find an older post than to retype all the details.

  • I need help choosing a new MBP (previous one was stolen)

    Hello everyone, I need help choosing my next macbook pro because my previous one (15" Core i7 high res anitglare screen) was stolen . As you probably tell I spent a lot of money on my previous one and now I am a broke college student that doesn't have $2,400 to drop on a replacement.
    So this is where you come in... because of budget reasons I have been looking at the 13 inch macbook pro but I just cannot bring myself to spend $1200 on a laptop with old technology (Core 2 duo processor) not to mention it is only 2.4ghz. I am not really sure what to ask about it I think i just need some good stats or other convincing information to allow me to buy it.
    I know about the student discount and the refurb. macs, are there any other reliable ways to get a less expensive MBP?
    I am a converted PC user and I LOVE macs, please don't let my budget make me revert back to a PC...

    Like you’ve already said refurb is a good option.
    I know it’s a bit late now but let me point you in the direction of Prey Project.
    Prey Project is an open source program I use on my MacBook Pro, it’s a program that can track your computer and phones if stolen using GPS / Google Maps etc to give you location of it.
    It will also take pictures of who is in front of it, log what they are doing etc.
    Check it out here http://preyproject.com/ this such an amazing program that is free to use, will work on Apple, Windows, Linux and Android phones.

  • I need help with my new iPod video!!!!!

    i got an iPod video and i am trying to get some songs onto it. i plugged my iPod into my computer and opened up iTunes. i was told that an iPod icon is supposed to pop up. when i plugged my iPod in, the icon did not show up. what do i do?!
    signed,
    I NEED HELP DESPERATELY!!!!!!!!!
    Dell Inspiron   Windows 2000  

    Make sure you have the latest version of iTunes (iTunes 7.0.2.16). To find the version of iTunes you have open iTunes, click Help, then About iTunes. If this does not work then follow the following instructions:
    For iTunes Technical support please call 1-800-APL-CARE
    or
    Another problem might be that your service pack of Windows 2000 is not the latest version (Windows 2000 Service Pack 4).
    I would recogmend getting Windows XP, many advantages over Windows 2000. Especially security and looks wise.

  • PLEASE NEED HELP TO FLASH NEW FIRMWARE ON LENOVO IDEA TAB A1107

    Please can anyone help me install new Android OS on my Lenovo tab A1107. Current os is Android 4.0.4. Also i have 2GB internal storage and 12.01gb USB storage and 8GB SD card inside,Please tell me the version of OS to instal and how to install it.

    Please divice power on and off want to flash new rom please help.
    mcl630 wrote:
    Go to Settings->About tablet->System updates.  If there's an update available, it will be there.

  • Need help encrypting, etc - New Wireless User

    I need help encrypting my network, I notice there are 5 wireless networks within range and they are all secure except mine.  I also wonder why my signal is just "fair" .. I don't really understand this whole wireless thing, so any help anyone could give me would be appreciated.

    First and foremost... what is the exact model number of your wireless device?
    Anyway, let's use a hardwired PC to configure everything. On the hardwired PC, open up IE and on the address bar type in 192.168.1.1 (username just leave it blank, password as a default is admin)...
    Go the wireless tab do these steps:
    ► change the SSID (that will be the name of your wireless network... use any name you would want to use)...
    ► for proper signal propagation choose channel 11
    Then to secure your network:
    ► go the wireless security subtab
    ► choose WPA personal
    ► input on the shared key box your desired wireless password (should be at least 8 characters long)....

  • Hey I need help with my new Video Ipod haha

    Hey whats up.. i need help.. i want to put some movies on my ipod from my computer.. but they wont go into itunes.. i need to find a converter to convert some divx movies and vlc what converter should i download???

    you've posted in the wrong section of this board..
    for support of iPod users on Windows, please ask the experts here:
    http://discussions.apple.com/forum.jspa?forumID=807
    iMovie is the video edit app, that comes free and exclusively on every Mac...

  • Need help buying a new computer

    Ok so I desperately need a new computer. my current one is 6 years old and is dying on me. What I'm looking for is something that will be able to run games like Knights of the Old Republic, The Sims 2, and eventually Star Wars: The Old Republic once it is released next spring. I don't want something that would be overkill for these games, but enough so that they don't lag and don't look awful. And I'm fine with buying a graphics card separately if it would be cheaper then buying some epic pc. My price range is $800-$1100, preferably $800 ^^; $1100 is like last resort no other option.
    so any help would be greatly appreciated
    On a side-note, my current pc until recently could play the above games fine, so I know I don't need some epic gaming computer to play them, but I just need help with which companies are reliable and what will be able to handle something like swtor's graphics in the near future.

    Asus Essentio Desktop / Intel® Core™ i5 Processor / 8GB Memory
    Model: CM5675-11 | SKU: 1308316
    This desktop features a double-layer DVD±RW/CD-RW drive for creating customized CDs and DVDs and a 16-in-1 media reader for storing or transferring important documents, favorite songs and special photos. The NVIDIA GT240 graphics features 1GB video memory for lush images.Windows 7 Home Premium preloaded Which Windows 7 edition is best for you? Compare.Learn more about Intel® processors. Information provided by Intel.
     3 Read reviews (4)
    Sale: $849.99
    Hey! You don't need a powerhouse, but as long as you have such a nice budget, you might as well get something nice. This is my personal recommendation based on specs, hardware and branding. Also, the case doesn't try to be 'too cool', it's a standard, functional case with a little better construction. No video upgrade needed. (This is tower only, if you need a monitor, that's a whole different cup of tea).
    I am a Bestbuy employee who volunteers on these boards on my own time. I am not paid for posting here, and you should understand that my opinions are exactly that - opinions. I do not represent Bestbuy in any way.
    : Open Mailbox

  • How to implement this need help

    I created a datacontrol for a named query which (using Ejb entity beans) which accepted a employee id and click on find show me the respected employee details in a table.
    case 1: In one single page
    when i added the form consisting of a single text box , button and the table to show the result of the find method in one single page it worked out perfectly,,,
    case 2 : using 2 different pages
    But then i tried adding only the form in one page named page1 and and the table to show the result in another page i.e page2 , Also in the command action of find button of page1 i asked it to redirect to page 2 and show result . But it never showed me any results..
    Question :
    1) How to implement case2 i.e to have a form on one page and the resultant table to be show on another page i.e When users sees first page he adds the employee id in text box and clicks find .The user then needs to be redirected to page2 and the result of search should be shown in table...
    Can anyone guide me over this... ???

    Hi,
    you use a method on the EJB that takes a argument (e.g. the employee ID). You then put the method result set on page 2 (the method argument shall be pointed to a request or session attribute using EL : #{sessionScope.EmployeeId}
    On the search page - when the user hits the search button - you set the attribute "EmployeeId" in the session before navigating to the next page
    Frank

Maybe you are looking for