String not being picked up in Function

Im trying to add a string to a FUNCTION, but because the string contains a bracket and comma its not picking the string up.
The STRING is : Christian (non-Catholic, non-specific)
Below is the Script 
SELECT c.DESCRIPTION
, count(*)
FROM [PLATOPROD].PSAG.dbo.PICS_Bedspace_current AS p
LEFT OUTER JOIN AR_20120209_ChaplaincyPatientList AS c ON LEFT(p.[Reg No], 7) = c.IDENTIFIER collate database_default
LEFT OUTER JOIN daily_builds.dbo.Daily_WardTrans_Static w on left(c.identifier,7) = left(w.unitno, 7)
WHERE (c.ID IS NOT NULL)
AND (c.description IN (select Param from [dbo].[fn_MVParamChar](@description, ',')) OR ('Protestant' IN (select Param from [dbo].[fn_MVParamChar](@description, ','))
AND c.description IN (select Param from [dbo].[fn_MVParamChar]('Anglican,Baptist,Christian,Church of England,Church of God,''Christian (non-Catholic, non-specific)'',Methodist,Pentecostal,Presbyterian,Salvation Army,Free Church,Other Free Church', ',')) ) OR @description = 'All,')
group by c.DESCRIPTION
Below is the Function:
ALTER FUNCTION [dbo].[fn_MVParamChar]
(@RepParam varchar(8000), @Delim char(1)= ',')
RETURNS @Values TABLE (Param varchar(8000))AS
BEGIN
DECLARE @chrind INT
DECLARE @Piece varchar(8000)
SELECT @chrind = 1
WHILE @chrind > 0
BEGIN
SELECT @chrind = CHARINDEX(@Delim,@RepParam)
IF @chrind > 0
SELECT @Piece = LEFT(@RepParam,@chrind - 1)
ELSE
SELECT @Piece = @RepParam
INSERT @Values(Param) VALUES(Cast(@Piece AS varchar(100)))
SELECT @RepParam = RIGHT(@RepParam,LEN(@RepParam) - @chrind)
IF LEN(@RepParam) = 0 BREAK
END
RETURN
END

Try the below query,
SELECT c.DESCRIPTION
, count(*)
FROM [PLATOPROD].PSAG.dbo.PICS_Bedspace_current AS p
 LEFT OUTER JOIN AR_20120209_ChaplaincyPatientList AS c
  ON LEFT(p.[Reg No], 7) = c.IDENTIFIER collate database_default
 LEFT OUTER JOIN daily_builds.dbo.Daily_WardTrans_Static w
  on left(c.identifier,7) = left(w.unitno, 7)
WHERE (c.ID IS NOT NULL)
       AND (c.description IN (select Param from [dbo].[fn_MVParamChar](@description, ',')) OR
         ('Protestant' IN (select Param from [dbo].[fn_MVParamChar](@description, ','))
  AND c.description IN (select Param from
   [dbo].[fn_MVParamChar]('Anglican,Baptist,Christian,Church of England,Church of God,Methodist,Pentecostal,Presbyterian,Salvation Army,Free Church,Other Free Church', ',')
   OR c.description IN ('Christian (non-Catholic, non-specific)') ) ) OR @description = 'All,')
group by c.DESCRIPTION
Regards, RSingh
Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'OR'.

Similar Messages

  • Delivery document not being picked while creating shipment document

    Dear All,
    Issue is regarding creation of shipment document.
    As i am creating shipment document in VT01N, am unable to get the delivery doc . ie., delivery document is not picked in shipment creation.
    I have created a sales order, picking is completed n saved, PGI not yet been done.
    Am unable to create a shipment document due to delivery document not being picked.
    i/p's will be of great help.
    with regards,
    Vijayashree

    Dear all,
    The issue is solved.
    As the Route was not picking in Sales Order so the delivery was not picked in shipment creation.
    Route determination setting was not correct.
    Regards,
    Vijayashree

  • Item in sales order not being picked into picking list

    Hi Gurus,
    Could you please tell me the possible reasons as why an item in the sales order which has enough stock not being picked into the picking list?
    Many Thanks
    Choudry

    Hi
    Delivery creation that is selection date is controlled by the schedule line of the line item in the sales order
    Try by changing the schedule lines in sales order in VA02
    there you try to change the delivery date to past
    It might be possible if you had enough stocks at that time
    Regards
    Raja

  • File not being picked by adapter

    My Source file name is xml_a1_en.xml
    the test files are of name xml_a1_02_en_2010.xml , xml_a1_03_en_2010.xml
    the files are not being picked up by adapter..Is the naming convention wrong for the test files or any reason?

    Hi Mr.King,
    I am assuming your OS is Unix system right?
    If yes -> check the file permission?
    if Only Reading: permission should be 664
    Move the file after reading: 775
    Regards,
    Senthilprakash

  • Large files not being picked by FTP adapter

    Hello,
    In our integration scenario, files from the AS400 (legacy system) are placed at a FTP location from where the XI picks up the file for processing. We have FTP communication channel.
    The file has about 8000 records is in binary format. When the file was placed it was not being picked up after the mentioned polling period of 60 secs. After manually inserting about 300 records which makes the file size smaller, the file is picked up bu XI and processed without error. With the 8000 records the file size was 2.5 MB.
    Thank you

    Please provide a J2EE trace at logging severity "Debug" for the location
    "com.sap.aii.adapter.file". Please do the following:
    - increase logging severity to "Debug"
    - set log levels to ERROR for all components
    - ONLY set log level to DEBUG for "com.sap.aii.adapter.file"
    - reproduce the problem and gather the defaultTrace.trc immediately
      after you reproduce
    - remember to reset the logging severity after you have reproduced as
      leaving it on "Debug" can cause performance problems in your system.
    Also the ftp server logs will be needed in this case.

  • Agreements Not Being Picked For SFTP Protocol in Oracle 11G

    Hi Anuj ,
    PFB the Details of the Issue :
    Agreements are not being picked for SFTP protocol even though From TP , To TP , Document Type and Revision are picked correctly .
    We are running on MLR11 , Version : 11.1.1.4.0 . Also we have set b2b.useCPAid to false in EM Properties so that Agreement is picked based on DocType Name , Revision and Partner Id's .
    Also when we used File Protocol its working Fine . The problem exists for SFTP Protocol .
    Error Code : B2B-50547
    Error Description     Machine Info: (gwl09072appg084) Description: Agreement not found for trading partners: FromTP TestEbxml, ToTP BTGS with document type rqRequestServiceRequest-1.0-INBOUND.
    Patch Level : 14114625
    Regards,
    Rohith

    Hi Anuj ,
    Thanks for the reply .
    Yes we are setting the Filename Format explicitly in the LC . As far as we have understood , naming convention FromTP_MSGID.xml
    is used to identify the TP and also MSGID is used to avoid duplicates and identification xpath is set to identify the Action .
    When we are using %FROM_PARTY%_%TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%_%TIMESTAMP%.xml , All parameters are identified as expected and Agreements are also being picked when we are using File Protocol . Only when we are trying with SFTP Prtocol , even though all values are being picked correctly , only agreement is not being picked . Could you please help ?
    Regards,
    Rohith

  • In Production Order Old Raw Material Batch No. not being picked (FIFO)

    Hi,
    We have activated Batch Management for ROH type of Materials with Split Valuation and the Strategy applied is FIFO.
    We have generated many such batches and consumed too, but lately out of many ROH mateials, 2 ROH who have Old Batches are not being picked and the Batch which is recently created is being picked at the time of Production Order Release.
    We have not done any changes into the Master Data nor the config during this period.
    Can anyone help what can be the issue ?
    Thanks in advance,
    Harris Panchal

    Hi,
    Actually our requirement is that we want to sort out the Batch as per the Earliest one and consume the earliest first, i.e. FIFO strategy.
    For that the MM Consultant has configured the following Charac:
    1. Stock Determination: Priority
    2. Value Assignment Type
    3. Batch Number
    Which I am feeling should be changed and to be as per the following:
    1. Created On
    2. Batch Number
    In OMCV, Classification is active with following option:
    4     Classification in foreground for new batches only for the following movements: 101, 309, 310, 561
    3     Classification always in foreground (all batches)   for the following movements: 321, 501
    Requesting your valuable inputs,
    Thanks and regards,
    Harris

  • What's the error?  Longtime site not being picked up by Google

    This site has been up for a year and is not being picked up by Google. What is the problem?
    Any suggestions much appreciated.
    www.elspethcameron.com

    +(sorry for my english, it usually is better than that I think/hope)+
    Ok... Let's see...
    www.elspethcameron.ca is just a forwarding url with cloaking (masking, masking the real url) enabled so it's not dynamic it doesn't change when visiting different pages. It is listed in google
    http://www.google.ch/search?hl=en&q=site%3Awww.elspethcameron.ca&btnG=Search&met a=
    but there is no content under this url because it is just forwarding visitors to the real website, just like a link would do that.
    The real website is, at least partially, on google with its content as you can see here
    http://www.google.ch/search?hl=en&q=site%3Aweb.mac.com%2Felspethcameron%2F&btnG= Search&meta=
    The other parts of the website are not indexed by google. I think that is because google is not able to crawl the nav bar because it is javascript rendering. You could make a second nav bar by your own and put it on the bottom of the page. Simply add a text field and put normal links in it to the other websites. Google will then follow them next time indexing your page.
    In addition to that you should watch the thread I posted before. Note that by making your sitemap you don't use www.elspethcameron.ca but the real url.
    Regards,
    Cédric

  • TS1363 My new IPod is not being picked up by my computer.  What should I do?

    My new IPOD is not being picked up by my computer.  What should I do?

    @vic_suav, thanks for the additional information. Could you please try to see if this does the trick?
    Quit iTunes on your PC, switch your iPhone on and make sure it's not locked, before connecting it to your computer. Then wait a minute or two until the "Download Photos" dialogue box pops up. When that happens, launch iTunes and wait a minute or two until iPhone shows up as a connected device.
    If the above doesn't work, follow the steps in 'How to restart the Apple Mobile Device Service (AMDS) on Windows' to restart the Apple Mobile Device Service, here: http://support.apple.com/kb/TS1567
    Otherwise, please try a different USB port on your PC. Then in your Windows 7, click Start and choose Control Panel. Click "Uninstall a program". Then verify that Apple Mobile Device Support is visible in the list of currently installed programs. If Apple Mobile Device Support is not listed, remove iTunes, QuickTime, Apple Software Update, Apple Application Support, and then reinstall iTunes. For removing and reinstalling iTunes, QuickTime, and other software components for Windows Windows 7, follow these steps: http://support.apple.com/kb/HT1923
    if all of the above fail, you can try some of the troubleshooting steps outlined in 'iOS Device not recognized in iTunes for Windows' article: http://support.apple.com/kb/TS1538
    Let me know how it goes. Good luck!

  • Forms Bean changes not being picked up from updated jar

    I've got an existing, working Bean with a single static method which my forms use to check the last modified date on a file. I've been trying to add a second method, with no luck. In an attempt to see if my new jar was being picked up, I changed the existing method to simply return "testChange". When it continued to return the string representation of the file modification date, I assumed my jar change wasn't being read.
    However, I eventually tried creating my new method in a separate class, this time not extending VBean, and include it in the same jar. I can now execute my new method just fine.
    My questions are
    1) Why didn't adding the new method to the existing class work?
    2) Given that I can demonstrate my changed jar is being used by the form, how on earth is the old method still returning the file date, when the code doesn't do that anymore???
    I've got it working, but I'd really like to understand why my previous attempts failed.
    Original class:
    public class myClass extends VBean
         public static String getLastModified(String filename)
              File file = new File(filename);
              return Long.toString(file.lastModified());
    Forms invocation:
    FUNCTION get_last_modified_date (file_name_in IN SWtype.SW_long_string)
    RETURN DATE
    AS
    v_last_modified SWtype.sw_long_string;
    BEGIN
    v_last_modified :=
    fbean.invoke_char ('SW_WEBUTIL_BLK.SWFILEUTILS'
    ,1
    ,'getLastModified'
    ,file_name_in
    return TO_DATE ('01/01/1970 00:00:00', 'DD/MM/YYYY HH24:MI:SS')
    + v_last_modified/(86400 * 1000);
    END;
    Method changed for testing:
    public class myClass extends VBean
         public static String getLastModified(String filename)
              return "testChange";
    New method:
    public static boolean isValidUTF8(String filename) throws FileNotFoundException,
    IOException
    <if not valid UTF8>
    return false;
    return true;
    Invoking the new method when it was in the bean (just returned null):
    v_result := fbean.invoke_bool('SW_WEBUTIL_BLK.SWFILEUTILS'
    ,1
    ,'isValidUTF8'
    ,:my_blk.file_name
    Invoking the imported Java method now that it's in its own class:
    v_result := myfilevalidator.isValidUTF8(:upload_blk.source_file);
    In case it's relevant, I'm using JDeveloper 10.1.3 and Forms Builder 10.1.2.0.2, running the forms locally on my OC4J instance.

    Why didn't adding the new method to the existing class work?
    2) Given that I can demonstrate my changed jar is being used by the formBoth statements point to the direction that the "old" class is still there, but maybe in a different jar-file. java takes the first occurence of a class, so maybe for the "old" class it finds it in a different jar, but the "new" class is not found in that jar and therefore taken from the actual jar. check The archive or archive_jini-tag and remove all unused or redundant jars. You maj also try to clear the jar-cache.

  • DP90 : Cost not being picked by DP90

    Hello everyone.
    We have a Z program which calls a BDC for DP90 in background mode with certain service orders.
    We are facing a very strange problem.
    Most of the times sales orders created are fine with all the costs being picked from service orders.
    But sometimes it doesn't pick up all the costs from service order, It randomly selects few cost and creates the sales order.
    The cost elements which are not picked up in the wrong sales orders do reflect in the correct ones, meaning the configuration part is checked and works properly.
    Can anyone please explain why all the cost elements are not picked up.
    Mind you that this doesn't happen regularly but is quite rare.
    Thanks.

    Hi,
    I want to generate billing based on cost spent on service in transaction DP90.
    I tried with BDC, but in sales price view the labour, travel and materilas are coming under header
    which have to be expanded like tree which is not working in BDC.
    Is there any BAPI or FM which is for DP90 which i can use in my program.
    Thanks
    Sree

  • Database adapter - timezone value not being picked up

    We are using Oracle SOA suite v 11.1.1.6, along with database adapter to connect to different Oracle database - D1 and D2. All 3 system - SOA suite, D1 and D2 are set to different timezones. Within the SOA composite, we are using Database adapter to
    query data from Oracle database
    execute pl/sql stored procedure in Oracle database.
    In all cases we noticed that the date time data seen in the SOA EM console is same as in the respective database system, but surprisingly the timezone value in the data field is constant and it does matches with that of SOA suite.
    <D1_DATE>2013-08-15T01:10:00.000-06:00</D1_DATE>
    <D2_DATE>2013-08-15T02:10:00.000-06:00</D2_DATE>
    Ideally the timezone value should match with that of respective database, from where the date value is being picked up. Did we miss any set up or this a known issue ?
    Thanks.

    The database column is of "Date" data type. Was just checking, if the DB adapter can be configured to look into the timezone set at the Oracle data base and use that along with the actual data in the "Date" type column
    Am aware that, if i use the "Timestamp with Timezone" it works good.
    Thanks.

  • Effects on Inventory when not performing Pick and Pack function in SAP

    Hi,
    I have a question regarding the inventory Module, Pick and Pack function. If I bypass this function and use copy from Sales order to do invoicing. What are the side-effect on the the inventory balances ( Quantity and value)?
    Thanks in advance.
    Phil

    Hi,
    If u don't want to use pick and pack function so there are no boundation.
    when u copy from sale order to direct invoicing there is no harm .
    u can do this without tension.
    Thanks,
    JRAJPUT

  • [Solved] keyboard layout not being picked up

    So I recently ran into a problem where my keyboard layout is not being correctly set up. When I run
    [ben@ksack ~]$ setxkbmap -print -verbose
    I am greeted with
    Couldn't interpret _XKB_RULES_NAMES property
    Use defaults: rules - 'base' model - 'pc105' layout - 'us'
    Trying to build keymap using the following components:
    keycodes: xfree86+aliases(qwerty)
    types: complete
    compat: complete
    symbols: pc+us+inet(pc105)
    geometry: pc(pc105)
    xkb_keymap {
    xkb_keycodes { include "xfree86+aliases(qwerty)" };
    xkb_types { include "complete" };
    xkb_compat { include "complete" };
    xkb_symbols { include "pc+us+inet(pc105)" };
    xkb_geometry { include "pc(pc105)" };
    My config in /etc/X11/xorg.conf.d/10-evdev.conf is the following
    # Catch-all evdev loader for udev-based systems
    # We don't simply match on any device since that also adds accelerometers
    # and other devices that we don't really want to use. The list below
    # matches everything but joysticks.
    Section "InputClass"
    Identifier "evdev pointer catchall"
    MatchIsPointer "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    EndSection
    Section "InputClass"
    Identifier "evdev keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "gb"
    EndSection
    Section "InputClass"
    Identifier "evdev touchpad catchall"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    EndSection
    Section "InputClass"
    Identifier "evdev tablet catchall"
    MatchIsTablet "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    EndSection
    Section "InputClass"
    Identifier "evdev touchscreen catchall"
    MatchIsTouchscreen "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    EndSection
    If I run
    setxkbmap -layout gb
    that fixes the problem but I can't figure out
    Why my config stopped working
    Where to include setxkbmap such that I get my map loaded correctly
    Any and all help greatly appreciated.
    Last edited by benjumanji (2012-06-15 23:00:58)

    ahhh. My locale is certainly wrong. I shall fix that, but that shouldn't effect the way that X configures the keyboard, right? I changed it anyway. Problem remains. I also fixed up my .xinitrc, that didn't help either. I think there must be something deeply wrong somewhere.
    What I mean by worked and then didn't is that at my keyboard was fine (gb) with X, then at some point after an upgrade it ceased to work properly i.e. was being configured as US kb.

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

Maybe you are looking for