I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".

Hello,
I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
Suppose , 
Parameter value : person 1,person2,person3 
table structure : 
Project Name | officers 1 | officers 2
here, officers 1 or officers 2 may contain names of multiple people.
expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2. 
please explain or provide solution in detail 
- Thanks

Hi Visakh,
Thanks for reply.
But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
Your solution is working fine for following scenario : 
Project 
Officers 1
Officers 2
p1
of11
off21
p2
of12
off22
with parameter : of11,off22 : it will give expected output
And its not working in case of :
Project 
Officers 1
Officers 2
p1
of11,of12
off21,off23
p2
of12,of13
off22,off24
with parameter : of11,off22 : it will not give any row in output
I need patten matching not exact match :) 
ok
if thats the case use this modified logic
CREATE PROC GetProjectDetails
@PersonList varchar(5000)
AS
SELECT p.*
FROM ProjectTable p
INNER JOIN dbo.ParseValues(@PersonList,',')f
ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
GO
Keep in mind that what you've done is a wrong design approach
You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Create a procedure which will pass table name as an argument

    Please let me know, I want to create a procedure which will take
    table name as an argument and will display total no. of rows of
    that table.

    Hopefully this code will help u.
    CREATE OR REPLACE PROCEDURE P1(TAB_NAME IN VARCHAR2, ROW_NO
    OUT NUMBER)
    AS
    SQL_STMT VARCHAR2(1000);
    BEGIN
    SQL_STMT := 'SELECT COUNT(*) FROM ' || TAB_NAME;
    EXECUTE IMMEDIATE SQL_STMT INTO ROW_NO;
    END;
    SQL > VAR A NUMBER
    SQL > EXEC P1('EMP',:A);
    SQL > PRINT A
    A
    12
    SQL > SELECT COUNT(*) FROM EMP;
    COUNT(*)
    12

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • I need to create a link which will send on email

    hi All
    i need to create a link which will send to email after click to that link it will directly opent that portlet so i want to know how to create
    runtime link.

    What you're referring to is a drop down menu. Those can't be created normally in iWeb. They can be added to a iWeb page but require an HTML snippet and javascript. Some possible javascript solutions have been posted in this forum. Search for drop down menu. Also do a Google search for drop down menu to get a number of sites with possible solutions.
    Or, you can create a separate Residential page and put photos of windows, shower doors, etc. on it and use them as links to the pages for the windows, shower doors. Those pages don't have to be included in the navbar. You can turn it off in the Inspector/Page/Page pane.
    Also see Section 9 of this iWeb FAQ site.
    Happy New Year

  • Create PDF file which will write to mdb

    HI there.
    I have a requirement to add some code to a set of PDF files which will be read by members of my team as part of their induction.   Each pdf has a form at the end which captures their name and a tickbox to state that they have read the document.  When a submit button as part of the form is clicked I would like to write these basic details to an access mdb database so that we can keep a check of who is compliant with the induction process.
    Is it possible to use Livecycle designer to create a document which will do this when opened in Adobe Reader?  I don't need the code to do this - just need to know if it is possible.  If not are there any other ways I could save the information on the form silently without the user needing to do anything other than submit the information?
    I've read somewhere that for certain things to work you need to activate some kind of reader extensions - is that the case for this solution?
    Thanks in advance for your advice.
    Matt

    Hi Matt,
    Yes, if the user has the free Adobe Reader, then database access will require the form to be Reader Enabled in LC/ADEP Reader Extensions.
    While you can Reader Enable a form in Acrobat (with restrictions), connecting to a database is not permitted.
    See here for a summary: http://assure.ly/etkFNU.
    Hope that helps,
    Niall

  • To create such script which will fetch all this data in form of create command

    Whenever I do a restore I always forget to reapply some database roles or application roles in post restore steps.We have one database of very different db roles,Grant permissions,Login and User permissions and they changes also frequently.
    What dmv's I required to create  such script which will fetch all this data in form of create command and after restore I just have to run those create commands and all the rights should visible as before .
    Thanks

    The context of your question is not entirely clear, but I assume that you restore a copy from one type of environment (for instance QA) to another (for instance development).
    To get group membership, you use the catalog views sys.database_principals and sys.database_role_members. Querying these is straightforward.
    To get permissions you would query sys.database_permissions. This view is more difficult to query, but you can take shortcuts depending on what is in use at your site.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • I live in india and i want to buy Iphone 4s ,which will be better choice a unlocked one, refurbished or one with contract which can be unlocked later?plz help

    I live in india and i want to buy Iphone 4s ,which will be better choice a unlocked one, refurbished or one with contract which can be unlocked later?plz help

    Do you research as to what is available in India and what the
    various prices/costs are. Only you can decide what is the
    best choice.

  • I want to buy the photoshop which will change the background on a portrait?

    I want to buy the photoshop which will change the background on a portrait?

    Hi willielois, you can use Photoshop CC or Photoshop Elements to do this. I have shared a video tutorial that can help you learn to do this.

  • Hi, can anyone tell me if I can have more than one iTunes account on the same PC. I've just bought my wife an iPad2 and want to create a separate account for her. Can I do that on the same PC as mine?

    Hi, can anyone tell me if I can have more than one iTunes account on the same PC. I've just bought my wife an iPad2 and want to create a separate account for her. Can I do that on the same PC as mine? Thanks.

    I would advise that you not set up a second Apple ID. It's really not necessary - having two Apple IDs won't affect how iTunes works with your iPads - and will just complicate matters. Each iPad will be treated independently and can be set to sync only the items you want on that particular iPad. If you really want to keep the two iPads separate, set up different iTunes libraries and have only those items you want on the related iPad in that library, rather than a different Apple ID. If you plan not to use a computer and just download directly to the iPads, you can again choose what apps and content each iPad gets.
    But answering your specific question, you can have content from up to five iTunes Store accounts on any one computer or iPad. To create a new iTunes Store account, you'll need a different email address, and from there you just create the account the same way you did the first one.
    Regards.

  • Transaction Currency Tables which will give totals only

    Transaction currency purpose  bseg, bkpf, bsis, bsid contain document wise details hence will not be useful for my purpose,   i need a table which will give transaction currency  totals only.

    Hi Anu,
    I am unable to understand your exact requirement as if you need total of any transaction currency then there must be a criteria for the same like one want to add all currencies monthly/annually/weekly for reporting purpose and in this case you have to write a report and add currencies.No tables can hold such calculative recordes.
    Please elaborate more so I can u'stand requirement.
    Regards,
    Gaurav

  • I want to create an HTML table of img maps dynamically from DB retrieves...

    Hi,
    How do I build dynamic HTML code in a function and then populate a HTML region to render it.. (did I say that right?)
    I want to create an HTML table of img maps dynamically from DB retrieves...
    Thank you, Bill

    Vikas and Andy,
    Using Andy's code I'll go further...
    I want to create a function that returns HTML code that has been built dynamically.
    create or replace function "GET_CH_TABLE"
    return VARCHAR2
    is
    HTML_STRING VARCHAR2(2000); -- Create a string variable
    BEGIN
    HTML_STRING:= '<table align="center">' ||chr(10)||
    ' <tr>' ||chr(10)||
    ' <td> TEST ' ||chr(10)||
    ' /td>' ||chr(10)||
    ' /tr>' ||chr(10)||
    ' tr>' ||chr(10)||
    ' td>' ||chr(10)||
    ' a href=https:// ............etc. etc.. building the <TABLE> and <TD> cells having whatever I want... example.. changing the name of an image dependant on something else..
    return HTML_STRING; -- output the string to the region
    --also tried htp.p(HTML_STRING);
    END;
    =====================================
    Building the dynamic HTML is not my problem. It is how to get it into a region and to be read as HTML from a function call...
    I'd like the source of the region to be the returned HTML from a function call to GET_CH_TABLE();
    but it gives error:
    ORA-06550: line 1, column 7: PLS-00221: 'GET_CH_TABLE' is not a procedure or is undefined
    ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Debug:
    1: begin
    2: GET_CH_TABLE();
    3: end;
    I

  • Any Function Module which will give user id or position

    Hello Friends,
       is there any standard function module which will give the attribute position id or user name if i pass the 'attribute id as CNT' with value of the CNT. i know there is a standard function module 'BBP_READ_ATTRIBUTES'. but this FM will give the value of the attribute id if i pass the user id and attribute id but i want user id or position when i pass attribute id and value.
    john.

    Hi,
    See this related thread:
    Re: Get all users given a specific product category
    You cna use the similar approach to find for the attribte cost centre.
    BR,
    Disha.

  • My daughter wants her own itunes account.  will she lose everything from my account?

    My daughter wants her own itunes account.  Will she lose everything from our shared account?

    Hi Randy,
    John is correct, there is no true "sharing" it's more like right of use, but she can still use all the stuff she has from your account on her device, it's just a little tricky. My daughter has had her own account for over a year but she had used my account before that. She has her own iPod, Macbook Pro, and now she just bought her own iPhone.
    It had never been a big deal to her until she got her phone because she has to use only her account, my e-mail and stuff she does not need on her phone. So use Home Sharing on your computer with her login and her login on her device. The biggest question is are you using two computers or one? With just a single computer it may make it harder because you really have no way of home sharing (I may stand correctly by someone else though). With two computers you just setup home sharing, login to both iTunes accounts with her login, use her computer (or the second computer) and drag all the stuff over to that iTunes library, music, apps, etc. Then they will be on her computer. Then she just drags them on to her iOS device. They will copy and she can use them.
    There is no way around updates though. They can only be updated with the original account, which I believe why John stated use iTunes Plus first, because the will not play at all under a different account login. The only advantage that my daughter wanted to use this for was progress on games, so she wouldn't have to start over. Most of our stuff are free downloads so it was not even a repurchase issue as much as time on a game issue.
    If you use only one computer, it should work the same way but I have not tried it so I can not say for sure. Logout of you account name and drag the stuff to her iOS device.

  • I'm a user of Mac OS X 10.4 Tiger and, as well, a user of Google fead reader, which will stop to work from July 1st 2013. Does anybody know of any alternative RSS reader which works on OS X 10.4? Thanks in advance.

    I'm a user of Mac OS X 10.4 Tiger and, as well, a user of Google fead reader, which will stop to work from July 1st 2013. Does anybody know of any alternative RSS reader which works on OS X 10.4? Thanks in advance.

    Hello, you still might be in luck...
    TenFourFox is the most up to date browser for our PPCs, they even have G4 & G5 optimized versions...
    http://www.floodgap.com/software/tenfourfox/
    In TFF>Preferences>General>Manfe Add-ons..., type rss in the Search all add-ons bar...

  • Error message when issuing a COMMIT in a store procedure

    Hello experts,
    Please help.
    I have a problem where i cannot specify a COMMIT in a store
    procedure. I have the following error message:
    =================================================================
    00034, 00000, "cannot %s in current PL/SQL session"
    // *Cause:  An attempt was made to issue a commit or rollback
    from a PL/SQL
    // object (procedure, function, package) in a session
    which has this
    // disabled (by 'alter session disable commit in
    procedure')
    // *Action: enable commits from PL/SQL in this session, or don't
    attempt
    // to use commit or rollback in PL/SQL when they are
    disabled
    // in the current session.
    =================================================================
    Thanks very much for a reply
    Kind regards
    Yogeeraj

    The solution is to issue the statement
    alter session enable commit in procedure;
    However, I'd think carefully about doing this. Procedures are
    often called as part of a wider transaction. If the procedure
    issues a commit ALL the preceding work is also commited. If
    there is something subsequent in the transaction that fails and
    issues a rollback, it will onlt rollback the work done after the
    procedure. This may lead to your database being in an
    inconsistent state.
    rgds, APC

Maybe you are looking for

  • Cisco 5508 with 7.0.98.0 and GTK interval

    I am looking where I can change the GTK interval for my controller. Any pointers, appreciated.

  • What's the max number of columns a table can have on 32 bit OS & 64 bit OS

    What is the max number of columns a table can have on 32 bit OS & 64 bit OS ? Edited by: sameer naik on 02-Jul-2010 02:11

  • Pixi keeps restarting for no reason

    Hello, I noticed a strange behaviour on my Pixi Plus. It keeps restarting after about 2 days running just fine. This happened mainly at night, which it's very annoying because it then asks for the SIM password. Crashing seems unlikely, there were no

  • Auto route change for high latency

    Dear Boss I have cisco 2811 at branch and 3845 at Head office. Two link with 256 kbps bandwidthe each. I did as follows: Interface Tunnel 1 Keep alive 5 4 IP xxxxxxx Interface Tunnel 2 Keep alive 5 4 IP yyyyyyy Ip route X.X.X.X tunnel 1 Ip route X.X.

  • Muse cc 2014: png distortion

    I'm having problem with new cc 2014 muse. I have logo file at ai. Now I export it as .png to get transparent background. When I place .png file to muse it looks very distort. I have also opened ai file to ps and placed .psd file to muse with same res