Home » SQL & PL/SQL » SQL & PL/SQL » Need help with a query
Need help with a query [message #355540] Fri, 24 October 2008 18:15 Go to next message
shinoy11
Messages: 4
Registered: October 2008
Junior Member
Hi,
I need a help with a query.
Select names from persons where name =:EnterName

This helps create a text box where we can input a name from the list. How can I enter multiple names seperated by commas? Thank you in advance for your responses.

Regards,
Shinoy

[Updated on: Fri, 24 October 2008 18:16]

Report message to a moderator

Re: Need help with a query [message #355545 is a reply to message #355540] Sat, 25 October 2008 00:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
AskTom varying elements in IN list

Regards
Michel
Re: Need help with a query [message #355774 is a reply to message #355545] Mon, 27 October 2008 08:49 Go to previous messageGo to next message
shinoy11
Messages: 4
Registered: October 2008
Junior Member
Hi Michel,
Thanks for your quick response. I am very inexperienced (read beginner) in using Oracle/SQL for generating reports. After I read the comments/inputs posted on AskTom, I am no sure if I understand it enough. So let me clarify what I understood.

I need to created a stored procedure for enabling the search ability using multiple values.

Then I need to call that stored proc for the original query.

Since I am not familiar with stored procs and I also dont want to mess up my db since I have admin priviliges, can you explain in a detailed manner, the steps I need to take for accomplishing the aforesaid task?

I am using Toad to view my results before migrating it to the reporting environment.

With that being said, any inputs from you are greatly appreciated.

Regards,
Shinoy
Re: Need help with a query [message #355776 is a reply to message #355774] Mon, 27 October 2008 08:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Then I need to call that stored proc for the original query.

You can't call a stored procedure from a query.
Explain with more details, with an example, what you want to achieve.

Regards
Michel
Re: Need help with a query [message #355790 is a reply to message #355776] Mon, 27 October 2008 09:52 Go to previous messageGo to next message
shinoy11
Messages: 4
Registered: October 2008
Junior Member
Please see the example below

S.Name Age Gender
Paul 25 M
Sean 37 M
Randy 20 M
Liz 18 F

When I execute the query

select * from table where s_name =:Enter_Name

this creates a text box in which I can enter one of the names in the table.

The result is what I want if I have only one value to enter

If I wanted to see the data of both Sean and Liz at the same time How do I do it?

The table I have has 32,000 row and each record has 40 variables like Age, Name, Gender, Location, Phone etc..

I do not want to manually enter both Sean and Liz data in the query i.e.

Select * from table where s_name like 'Sean|Liz'


Using the original query
select * from table where s_name =:Enter_Name (instead of entering one name, I want to have multiple names seperated by commas)

Thank you

Re: Need help with a query [message #355792 is a reply to message #355790] Mon, 27 October 2008 09:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Box? Is this Forms?

Regards
Michel
Re: Need help with a query [message #355798 is a reply to message #355792] Mon, 27 October 2008 10:39 Go to previous messageGo to next message
shinoy11
Messages: 4
Registered: October 2008
Junior Member
No it is not. Once the query is run, it displays a free text popup where I can enter one value.
Re: Need help with a query [message #355799 is a reply to message #355798] Mon, 27 October 2008 10:44 Go to previous message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is your Oracle version?
Anyway the following will work:
http://tkyte.blogspot.com/2006/06/varying-in-lists.html

Regards
Michel
Previous Topic: sort order based on multiple conditions
Next Topic: Join one-to-many fields in a single row
Goto Forum:
  


Current Time: Fri Dec 09 08:05:05 CST 2016

Total time taken to generate the page: 0.05005 seconds