Dynamic sql reurns no data when multiple values are passed.

(Dynamic sql returns no data when multiple values are passed.)
Hi,
While executing the below dynamic sql in the procedure no data is returned when it has multiple input values.
When the input is EMPID := '1'; the procedure works fine and returns data.Any suggestion why the procedure doen't works when input as EMPID := '1'',''2'; is passed as parameter?
=======================================================
create or replace PROCEDURE TEST(EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
stmt VARCHAR2(9272);
V_EMPID VARCHAR2(100);
BEGIN
V_EMPID :=EMPID;
stmt := 'select * from TEST123 where Empid is NOT NULL';
IF V_EMPID <> '-1' THEN
stmt := stmt || ' and Empid in (:1)';
ELSE
stmt := stmt || ' and -1 = :1';
END IF;
OPEN rc FOR stmt USING V_EMPID;
END Z_TEST;
============================================================
Script for create table
==================================================================
CREATE TABLE TEST123 (
EMPID VARCHAR2(10 BYTE),
DEPT NUMBER(3,0)
===========================================
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('1',20);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
=============================================
Select * from TEST123 where Empid in (1,2,3)
EMPID DEPT
1     20
2     10
3     30
3     30
2     10
===================================================================
Any suggestion why the procedure doen't works when input EMPID := '1'',''2';?
Thank you,

The whole scenario is a little strange. When I tried to compile your procedure it couldn't compile, but I added the missing info and was able to get it compiled.
create or replace PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
  stmt        VARCHAR2 (9272);
  V_EMPID     VARCHAR2 (100);
BEGIN
  V_EMPID := EMPID;
  stmt := 'select * from TEST123 where Empid is NOT NULL';
  IF V_EMPID = '-1' THEN
    stmt := stmt || ' and Empid in (:1)';
  ELSE
    stmt := stmt || ' and -1 = :1';
  END IF;
  OPEN rc FOR stmt USING V_EMPID;
END;If you pass in 1 as a parameter, it is going to execute because the statement that it is building is:
select * from TEST123 where Empid is NOT NULL and -1 = 1Although the syntax is valid -1 will never equal 1 so you will never get any data.
If you pass in 1,2 as a parameter then it is basically building the following:
select * from TEST123 where Empid is NOT NULL and -1 = 1,2This will cause an invalid number because it is trying to check where -1 = 1,2
You could always change your code to:
PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
  stmt        VARCHAR2 (9272);
  V_EMPID     VARCHAR2 (100);
BEGIN
  V_EMPID := EMPID;
  stmt := 'select * from TEST123 where Empid is NOT NULL';
  stmt := stmt || ' and Empid in (:1)';
  OPEN rc FOR stmt USING V_EMPID;
END;and forget the if v_empid = '-1' check. If you pass in a 1 it will work, if you pass in 1,2 is will work, but don't pass them in with any tick marks.

Similar Messages

  • How to Display values in order when Multiple values are selected in the Parameter List

    <p>Hi</p><p>I have a report which runs on the parameter(SalesPersonName) selected.<br />Report has a group section where for each SalesPersonName we have different actions(Lead,Prospect,Active and so on) he had performed which is the basis for the group.</p><p>Now if i need multiple Value selection in the parameter,which i am able to acheive but the order in which it gets printed is not the right one.</p><p>I want intially all the actions performed by one sales person printed and then the second one should start.</p><p>Can any one help me in this aspect.</p><p>Thanks in advance</p>

    <p>If I understand your report structure correctly - you have one Grouping on Actions.  So could you not add another grouping on SalesPersonName above the Actions grouping that you currently have?</p><p>So the new structure would be:</p><p>G1 - SalesPersonName</p><p>G2 - Actions (current grouping you have)</p><p> </p><p>Whether or not you suppress or don&#39;t suppress the new grouping is your choice, but it will then force the ordering that you are asking about (assuming I understood) </p>

  • Error in when null values are passed to datefield

    Hi all,
    We are facing some issue with null values in date fields while calling a stored procedure using JDBC Adapter in one of the interfaces.
    When the value is null, XI gives errors in the communication channel.
    Case 1 , When the value is mapped to blank. : The adapter gives an error related to date format. Unsparseable date “”.
    Case 2 , When the value is not mapped at all : The adapter gives an error related to wrong number of arguments for the stored procedure.
    One option for fixing this issue is to hardcode the value to all zeros in a appropriate date format. However this is not acceptable in our case.
    Did anybody face this issue before. If yes what was the approach taken. Can you please let me know if anybody has any inputs on this.
    Thanks in advance,
    Younus

    you can clear the field key tags mandatory in the XML Schema interpreter parameter and make the Empty string value to Empty string from null value.
    For mapping : you can pass a value that is of the same format of date; but you can take your own value in the database since you are parsing the date format from one to other
    thanks
    nikhil

  • Help with POST data if  multiple selections are chosen

    I've created a form with a menu (list) that includes all 50
    states. I'm using the POST option, along with PHP, to process the
    form data, which will be emailed to me. The list-menu looks like
    this:
    http://askdave.info/help/states_menu.gif
    and I have "Allow Multiple Selections" checked in the Property
    Inspector.
    If the user chooses multiple states, I want
    EACH of those states to be listed in the email that I
    receive. Right now, if I check multiple states, I only get
    the very last state that's selected. For example, here's the
    email I get after I check 5 different states.
    http://askdave.info/help/formdata.gif
    Problem--> In this email, only one state is listed
    (Hawaii) even though I selected 5 different states. How do I get
    the form data to list ALL states that are checked?
    Here is what I have:
    <form name="form1" method="post" action="process.php">
    <input type="hidden" name="required"
    value="name,phone,email,states,capital" />
    And then for the menu that lists the states, I have:
    <label>
    <select name="states" size="7" multiple id="states">
    <option>All States</option>
    <option>Alabama</option>
    <option>Alaska</option>
    <option>Arizona</option>
    <option>Arkansas</option>
    and so on...
    What am I missing? How do I get the PHP script to send
    multiple values, if multiple values are chosen? (I'm new to PHP, so
    go easy on me. I can post my code, if necessary.) Is this a PHP
    issue, or do I need to add something to the HTML form?

    Hi,
    >>
    I think DynaForm stands for Dynamic Form
    >>
    this makes some sense ;-) I was just wondering because there
    is a pre-made script called DynaForm
    here, but
    it has a different "logistics" than yours.
    However, both "DynaForm" versions are pretty basic, as they
    just deal with non-multiple values - form fields like single line
    input fields, texareas and non-multiple select´s. Your script
    e.g. just loops through all existing form fields using the
    "foreach" method:
    //Pulls form fields & values.
    foreach ($this->post as $field => $value) { // looping
    through all form fields
    if ( $field == 'required' ) continue;
    $this->_addLine($field, $value); // here´s where the
    field´s name/value consolidation happens
    ...and simply consolidates a field´s "value" with its
    associated "name". The problem is : this method just works for
    fields having just 1 value -- but any "multiple value" form fields
    (e.g. your "states" select or checkbox groups which can pass
    multiple values as well) actually require a separate "foreach"
    treatment within the script, and this hasn´t been incorporated
    here.
    That said, I suggest using an other pre-made solution like
    PHP
    Form Mail script that´s capable to handle your multiple
    values - scenario innately.

  • File corruption on SDCard when multiple files are being written from WinCE 6.0R3

    We currently have file corruption problems which we have been able to reproduce on our system which uses WinCE 6.0R3. We have an SDCard in our system which is mounted as the root FS.  When multiple files are being written to the file system we occasionally
    see file corruption with data destined from one file, ending up in another file, or in another location in the same file.  We have already written test SW that we have been able to use to reproduce the problem, and have worked with the SDCard vendor to
    check that the memory controller on the card is not the source of the problems.
    We know that the data we send to WriteFile() is correct, and that the data which eventually gets sent through the SDCard driver to the SD card is already corrupted.
    We believe that the problem is somewhere in the microsoft private sources between the high level filesystem API calls and the low level device calls that get the data onto the HW.
    We have confirmed that the cards that get corrupted are all good and this is not a case ofpoor quality flash memory in the cards. The same cards that fail under WinCE 6.0R3 never fail under the same types of testing on Windows, Mac OX, or linux.  We
    can hammer the cards with single files writes over and over, but as soon as multiple threads are writing multiple files it is only a matter of time before a corruption occurs.
    One of the big problems is that we are using the sqlcompact DB for storing some data and this DB uses a cache which get's flushed on it's own schedule. Often the DB gets corrupted because other files are being written when the DB decides to flush.
    So we can reproduce the error (with enough time), and we know that data into the windows CE stack of code is good, but it comes out to the SDcard driver corrupted.  We have tried to minimize writes to the file system, but so far we have not found a
    way to make sure only one file can be written at once. Is there a setting or an API call that we can make to force the OS into only allowing one file write at a time, or a way of seeing how the multiple files are managed in the private sources?
    Thanks
    Peter

    All QFE's have been applied we are building the image so we have some control.
    I have build an image which used the debug DLL's of the FATFS and I have enabled all of the DebugZones.  The problem is still happening. From the timings in the debug logs and the timestamps in the data which corrupts the test file I have been able
    to see that the file is corrupted AFTER the write is complete. Or at least that's how it seems.
    We finished writing the file and closed the handle. Then more data is written to other files. When we get around to verifying the file it now contains data from the files that were subsequently written.
    What I think I need to do is figure out in detail how the two files were "laid down" onto the SDCard.  If the system used the same cluster to write the 2 files then that would explain the issue.

  • WRT160n v3 has slow connection when multiple users are connected

    As of last night my router has been producing slow connectivity when multiple users are connected to it, but it's perfectly fine when only one user is connected.
    I am on a laptop myself, but we also have a second laptop and a desktop where the modem and router are set up.
    I have upgraded the firmware so that is up to date.
    We have Comcast Fiber Optics so my internet speed is normally quite fast even when all of my computers are connected.
    Some settings that I have that might help resolve the issue:
    I am using DHCP Configuration.
    My Channel Width is set to 20 MHz and I am using Channel 11.
    The Security Mode is set to WPA Personal. I had it on WPA2 Personal but I read that changing to WPA Personal might help and so far it doesn't seem to have done anything.
    I set the Beacon Interval to 50, Fragmentation Threshold to 2304, and RTS Threshold to 2304.
    Everything else is set to the default factory configuration.
    Just today I received a notice that said "Windows has detected an IP Address Conflict", but ever since I reinstalled the Firmware it hasn't come back. I've rebooted both my laptop and the desktop to confirm it hasn't come back as well.
    I consider myself to be computer savy, but I just can't figure out what the problem is as I've tried everything that I could think of including reconfiguring my router and restarting my modem as well. This problem has presented itself in the past before but unfortunately I cannot remember what I did to fix it.

    Try using inSSIDer to help you find the best channel.
    http://www.metageek.net/products/inssider/
    If that doesn't help, you can try disabling WMM.
    Edit:  You should use WPA2 AES security for best performance.

  • Safari warning before quitting when multiple tabs are open?

    I'm a rather clumsy typist who often uses Apple+Tab to toggle through my open programs. This works great 99% of the time, but that other 1% is rather frustrating considering that the Q key is right next to Tab.
    Apple guys, please implement a pop up/drop down warning when attempting to quit Safari when multiple tabs are open (or at least the option to enable or disable it). I use this browser for work and often have many tabs open, so accidentally quitting the browser only impedes on my workday. I know I should be more accurate, but isn't that what part of progress is? The empowerment of laziness? =)
    Thanks for your time, and hopefully we see this included in soon-to-come upgrades!
    Oh, and if this feature is already available, feel free to show me the way.
    G4   Mac OS X (10.4.7)  

    jefftovar,
    I created and modified the Safari Keyboard Shortcut
    Quit (⌘+Q) command to (⌘ControlQ) by using System
    Preferences...>Keyboard Shortcuts.
    ;~)
    Great suggestion! But, the default Quit (⌘+Q) command is still in effect. I've looked about in trying to deactivate it, but can't seem to find it. How did you get rid of yours?
    G5   Mac OS X (10.4)  

  • A lot of memory is used when multiple tabs are open

    Is there anything that can be done about the insane memory usage in Firefox when multiple tabs are open? I often have 20+ tabs open and the amount of RAM that Firefox uses when I have it open with this many tabs is just ridiculous. As an example of this, I just restarted Firefox after checking the Windows Task Manager. The Task manager said that Firefox was using 1.2 GB of RAM. I did have 32 tabs open, but this seems excessive even for this many tabs. Some of the tabs were image heavy, but none of them had any video in them. I'd think 10 MB per tab of RAM would be plenty to cover these kinds of pages, maybe 20 MB at most. The upper end of that range would be 640 MB of RAM. Instead, it appears to be using an average of 40 MB of RAM per page when this many tabs are open.
    Is there anything that can be done to reduce amount of memory being used when multiple tabs are open? It really shouldn't need this much RAM to serve this many pages.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Error: Show Details cannot be executed when multiple items are selected in a report filter field or in a slicer

    I have connected TABULAR Model to Excel, and in the pivot the filter is on multiple dimensions. When doing the drillthrough action it gives error - Error: Show Details cannot be executed when multiple items are selected in a report filter field or in a slicer
    Is there any workaround to this error?  so that drillthrough can be done even with multiple selection.

    Hi Vikas,
    The reason behind the error message requires the knowledge on what happens at the backend. When you perform a drill-through action, a query is sent to Analysis Services. This query is expressed in a query language called Multi-Dimensional Expression (MDX).
    Since the MDX language doesnot support drill-through command against a set (collection of tuples) an error is persisted. 
    For now, there is no workaround as it is a limitation of the underlying language that is generating the query.
    When multiple items are selected you lose the ability to drill-down on individual metrics. To resolve you must either:
    1. Select a single Item.
    2. Select all items.
    Hope this helps!
    Please mark as Answer if this helps! Thanks, Rajasekhar.

  • Report of Total GR qty/IR qty,date when last GR was passed (latest one)

    Dear all
           Kindly let me know how to get the below report using input of PO no:
    Report of Total GR qty,IR qty,date when last GR was passed (latest one),date when last IR was passed (latest one)
    Standard t.code such as ME2n.me2l is not giving the above report.

    Dear
    Try ME80FN and ME2N/L with the setting with Selection Parameters
    regds
    dev...!

  • X pro crashes when multiple documents are opened

    x pro crashes when multiple documents are opened

    Hi travisc74509405,
    Could you please let me know what version of OS are you using.
    Also, let me know how much RAM and free hard disk space is available on your machine.
    What exact dot version of Acrobat X do you have? You might check for updates under the Help menu to use the latest patch i.e. 10.1.13
    Hope to hear from you.
    Regards,
    ~Anubha

  • After Installing Bitdefender 2011 Firefox is very slow and worse when multiple tabs are open

    Firefox performs very poorly after I installed Bitdefender 2011. There was no such problem with Bitdefender 2009. When multiple tabs are open, switching between them is not possible until tab contents are completed.

    As ninjafox says, the problem seems to be the BitDefender Anti-phishing Toolbar. Disabling this through Tools -> Add-ons and restarting Firefox seems to fix the problem for that session. However, the problem then reappears when the computer is restarted, presumably because BitDefender re-enables the toolbar.
    Another way of disabling all add-ons when starting Firefox is to hold down Shift while clicking on the icon (Windows only I think - at least doesn't work on Ubuntu for me).

  • Multiple values are selected in a multiselect prompt then we can get indivi

    Hi Experts,
    Can it be possible in OBIEE that if multiple values are selected in a multiselect prompt then we can get individual graph for each selected values?
    For eg if in a multiselect prompt,values such as bangalore,pune,hyderbad etc are selected then the result in a report diosplays 3 graphs one for each state.
    Waiting for any work arounds on this.
    Regards
    Ashish

    hi Ashish,
    Pull the cities in Section's section of pivot table and construct the graph ,use is prompted filter on the city
    It should work
    thanks,
    Saichand.v

  • In column Chart when Y values are grater than y linear axis maximum it doesnt show the Bar

    Hi Guys,
    In column Chart when Y values are grater than y linear axis maximum it doesnt show the Bar.But i want show the bar upto the max limit of y linear axis without changing the max limit.
    Consider following example:
    Y values are 80 90 200 300
    and following are the output :
    Left:When i am not setting maximum property of linear axis.
    Right :When i am setting maximum property of linear axis to 200.
    In right 4th bar is not visible bcoz value for that bar is 300 which is excedding  maxium.But i want the 4th bar to appear same as 3rd bar.
    How i can do this?
    Thanks in advance.

    Are you going to show the bar going past the maximum value?
    If not, then you should change the Y value when entered into the array to the maximum value allowed. i.e.
    if(itemYValue > maxAllowedValue) {
         itemYValue = maxAllowedValue;
    Where maxAllowedValue is a variable you set on the application to control the maximum value for the chart.
    This is assuming that you are loading the values into an Array before updating the chart dataprovider with that array.

  • Dynamic sql to insert data in table

    hi
    I wish to insert 5 records in a table at runtime.
    i.e the data should be entered at runtime.
    I tried using a for loop but failed ..
    I think it is possible thru dynamic sql ...
    could someone help me out ..
    regards
    susmitha

    If your database is 8 or above, you might want to try something like:
    for i in 1..5 loop
    execute immediate 'insert into table_name ' ||
    '(your_field) values (your_value)';
    end loop;
    If your databasae is lower than 8, then you will have to use dbms_sql command instead. Hope this helps.

Maybe you are looking for

  • Creation of Credit memo in 3rd Party process

    Hi, Could you please explain about how to create Credit memo to the customer in Thirdy party process. 1. After final billing (F2) happened how can I create Credit memo request (Any specifi Doc type, with reference to what) and also Credit memo. 2. Le

  • My Macbook Pro will not load past grey Apple screen...

    Last night my Macbook Pro froze so I closed it and went to bed. Today when I opened it, it was still frozen, so I held down the power button and rebooted it. It got as far as the grey Apple screen with the spinning wheel and will not load any further

  • Is this possible - Import Flash swf which then imports an external swf

    Hi, I was wondering if it's possible to (as the title says) to import an swf which itself imports an external swf? Explanation - I've got an scrollbar created in flash...and to keep it tidy i've created the scroll 'content' as another swf which is im

  • Size of jpg for dvd menu?

    When burning a dvd in FCPX (I'm running 10.0.9), it's possible to place a jpg in the menu, as sort of a cover image. Does anybody know the ideal pixel measurements or aspect ratio for that jpg? Whenever I put a jpg there, FCPX automatically crops it

  • Converting from Claris - is there a way?

    Years ago I wrote some curriculum documents using Clarisworks on my first iMac. (At the time, Claris did the job and I wasn't fussy.) I had all of these transferred to my newer iMac (intel) not realizing that I wouldn't be able to open them. Recently