Search for value otherwise select all...decode?
Hi all,
I'm wanting a reasonably straight forward (sounding) result from a query: I want to select data where a certain column equals a value, otherwise I want to return all results.
Let me know if you need more details.
Thanks!
Hi,
djston wrote:
Hi all,
I'm wanting a reasonably straight forward (sounding) result from a query: I want to select data where a certain column equals a value, otherwise I want to return all results.
Let me know if you need more details.Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only). You can skip this if the problem is based on commonly available tables, like those in the scott schema.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If the problem involves parameters, give a couple of examples of different parameters, and the results you want from each.
Always say which version of Oracle you're using.
For example:
"I'm using Oracle 10.2.0.3.0.
I want to find all the people in the scott.emp table who have a given job; but if nobody has that job, then I want to select everybody.
For example, if I give 'MANAGER' as the parameter, then I want these results:
{code}
ENAME JOB
BLAKE MANAGER
CLARK MANAGER
JONES MANAGER
{code}
because those are the only people in the table with job='MANAGER'.
However, if I give 'DBA' as the parameter, then I want to see all 14 rows from the table, because there is no row where job='DBA'."
If that happens to be what you want, here's one way to do it:
VARIABLE target_job VARCHAR2 (10)
-- EXEC :target_job := 'DBA';
-- EXEC :target_job := 'PRESIDENT';
EXEC :target_job := 'MANAGER';
SELECT ename, job
FROM scott.emp
WHERE job = :target_job
OR NOT EXISTS (
SELECT 1
FROM scott.emp
WHERE job = :target_job
ORDER BY ename
;Noticed that this query involves an extremely rare un-correlated EXISTS sub-query. (At least intentionally un-correlated EXISTS sub-queries are rare.)
You could get the same results using DENSE_RANK and a CASE expression.
Similar Messages
-
Hi all,
I am fetching data in the following manner,
1. Find the deliveries items based on the search criteria
2. Pull in the material numbers for each item in the delivery
3. Pull in Planned goods movement date LIKP-WADAT
4. Exclude materials in the list where MARA-MAGRV = TB01
5. Find the External material group value for the remaining list MARA-EXTWG
6. Search for values in class ZEHS_DATA
7. Pull in value for characteristics
i. ZEHS_PLANT
ii. ZEHS_RELEVANT
8. Eliminate delivery items where ZEHS_RELEVANT = N for next steps, however display what was found
9. With EMG for delivery items and ZEHS_RELEVANT = Y pull all fields.
In which the class ZEHS-DATA is having fields like:
ZEHS_FORM
ZEHS_RELEVANT
ZEHS_PLANT
COLOR_SUNNBR etc,
My question is how do I pull values from class ZEHS_DATA??
Thanks,
Debrup.Hi
if you have values in a variable declared in CLASS, just call another method of this CLASS with an export paramtere ( export means exporting to the program)
depending the requirement the method can be PUBLIC or PRIVATE etc
Regards
Ramchander Rao.K -
Search for Main Group Not all Subgroup
Search for Main Group Not all Subgroup
My illustrator project may have 5 main groups, which may all included 100 subgroups. I would like to search for main group without having to search through all subgroup, because too many and too long for the script.
For the moment I have given a name to all Main group but the process is much too long.
Marcel
tell application "Adobe Illustrator"
activate
set groupCount to count group items in current document
repeat with i from 1 to groupCount
set selection of current document to {}
set groupRef to group item i of current document
set groupName to name of groupRef
if (groupName contains "MainGroup") then
set selected of (groupRef) to true
display dialog groupName
end if
end repeat -- with groupCounter from 1 to groupCounter
end tellI don't do AS but this seems to be the culprit
set groupCount to count group items in current document
count your groups in the current "Layer" to narrow it down to main groups only, groups within groups will be ignored. -
LOV - Require User to always Search for Values option
Hi All,
I have build a Supervisor LOV,But when I click the LOV(Flash light Icon), the new LOV window opens and it fetches the entire list of Supervisors which takes lots of time and LOV times out in many of the cases.
I want the LOV window should open without bringing the entire list of suprevisor and let User enter some Name to be searched.
To achieve the same,I enabled the option
Require User to always Search for Values option
(Immediately Displays the Search Dialogue when LOV is exapnded)
But it is not working.
Is there a way to do it ??
Regards
JujaarHi Tamir,
Thanks for you updates.
I dont think so,that I need to create a table or Materialised view.Cause I am taking the data from per_all_people_f directly.All the employees who are managers.
But I want that when users clicks on the LOV ,it should open and should force user to search for some employee .
As of now it fetches the entire list while opening up,when the user clicks on LOV button.
Thanks and Regards
Jujaar Singh -
Search for people by selecting keywords from dropdown boxes
Hi,
I have a requirement where the user wants to search for people in an organisation using specific values instead of only free text.
On the search page the user wants to select business unit,location etc from a drop down box and then search for all people in that unit. Is this possible without custom coding?
Thanks in advance for your help.
Regards,
VJHi VJ,
As I understand, you would like to add drop-down boxes for sorting search results in SharePoint 2013. I'd suggest you consider customizing refiners in search result page.
If you would add refiners for people, then you might add refiners to people search result page. Here are the references for detail information for refiners and how to add refiners:
http://blogs.technet.com/b/tothesharepoint/archive/2013/11/07/plan-to-use-refiners-on-a-search-results-page-in-sharepoint-2013.aspx
http://blogs.technet.com/b/tothesharepoint/archive/2013/11/11/how-to-add-refiners-to-your-search-results-page-for-sharepoint-2013.aspx
Regards,
Rebecca Tu
TechNet Community Support -
How to search for value records for a specific period of time?
Hi,
I am building an application where I need to use BDB to store tons of call records.
In the call records, I have the following fields:
1. from-caller
2. to-caller
3. begin-time
4. end-time
5. account-code
6. user-code
I want to use end-time's microsecond representation to serve as the Key.
So, how can I do the following data lookup?
1. Search for all Value records between 2009-10-11 to now()
2. Search for all Value records between 2009-10-11 to now() with account-code = 100
3. Search for all Value records between 2009-10-11 to now() with account-code = 100 and user-code=10
Is there any similar examples out there that I can refer to?
Thanks,
JBHi,
Btw, my operation is mostly:
1. Append call records
2. Search call records
3. Remove ending records that are older than XX days
Please kindly advise on how I should best structure the data to meet this purpose.
Thanks,
JB -
How to search for a string in ALL Function Modules source code
Hello,
I want to search for the string "HELLO" in all FUNCTION MODULES source code(FM, no reports/programs).
Is this possible? How?
Cheers,
Andyhi,
Execute RPR_ABAP_SOURCE_SCAN to search for a string in the code ... Press where-used-list button on the program which takes to the function group or the function module where it is used ..
Regards,
Santosh -
Bridge - Search for folders and view all contents at once?
Say I do a search for "Landscape" and it brings up 25 folders on my hard drive, is there a way to view the contents of all my folders at once?
Thank you,
BenjaminI have found exactly what I was looking for. And there it is... on AEScripts.com. Color me embarrassed.
For anyone else who's interesed in the answer I found "pt_EffectSearch" by Paul Tuersley.
Marc -
HT1491 get black screen when I try to search for books by category all other functions ok
get black whebtrying to search for books by category
Hello there, mrecon.
First you may try closing out of the iTunes store by following the steps in this Knowledge Base article:
iOS: Force an app to close
http://support.apple.com/kb/ht5137
If the issue persists, then you may want to do the steps above again and then restart/reset your iPad using these steps:
Turn your iOS device off and on (restart) and reset
http://support.apple.com/kb/ht1430
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro. -
Search for a column in all SSIS packages in a Folder
Hi
We are changing the datatype of one of a column for a huge table from INT to BIGINT. All SPs are being changed to accomodate this change.
All the SSIS packges havebeen downloaded to a folder. And I need to find the instances of this column in around 250 packages.
Is there a quick way to do this instead of opening up each package and looking for the column?
I dont have access to MSDB so my search should be based o nthe packages inthe folder.
Thanks
rajiv
RajivYou can do it using ssis package
Create a table with two columns
Table (PackageXML,PackageName)
one a xml column and another varchar column for this
1. Add a SSIS package with ForEachLoop container. point to folder containing your SSIS packages. Choose filetype as *.dtsx
2. Inside loop add a variable to get package names. choose option as Fully qualified (FilePath)
3. Add another variable and store filename alone extracted from above created variable (FileName)
4. Add a variable to hold query (Query) and assign an expression to it as
"INSERT YourTable (PackageXMl,PackageName)
SELECT *,'" + @[User::FileName] + "'
FROM OPENROWSET(BULK '" + @[User::FilePath] + "',SINGLE_BLOB) x"
5. Add a SQL task inside loop, choose SQLSourceType as variable and point to Query variable
Execute this package. This will cause it to load the code for all packages inside your table
Once this is done then you can just query the table as below to get package with column reference
SELECT PackageName
FROM Table
WHERE CAST(PackageXML AS varchar(max)) LIKE '%columnname%'
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Searching for values in a specific field using REST Search
To conduct a Search using REST...you only have the querytext parameter which searches all fields. How can I search within a specific field using REST?
BrianYou can use the following code as an example to post a query. The example shows how to search against the title managed property. It also shows you how to bring back certain properties for viewing and refiners. You can also do the same with a GET.
function executeRESTSearch() {
var appweburl = _spPageContextInfo.webAbsoluteUrl;
$.ajax(
'url': appweburl + "/_api/search/postquery",
'method': 'POST',
'data': JSON.stringify({
'request': {
'__metadata': {
'type': 'Microsoft.Office.Server.Search.REST.SearchRequest'
'Querytext': 'title:whatever',
'Refiners': 'title,created',
'SelectProperties': { 'results': ['created','path'] },
'SortList': {
'results': [{
'__metadata': {
'type': 'Microsoft.SharePoint.Client.Search.Query.Sort'
'Direction': 1,
'Property': 'created'
'headers': {
'accept': 'application/json;odata=verbose',
'content-type': 'application/json;odata=verbose',
'X-RequestDigest': $('#__REQUESTDIGEST').val()
'success': function (data) {
var d = data.d.postquery.PrimaryQueryResult.RefinementResults.Refiners.results[0].Entries.results[0].RefinementValue;
'error': function (err) {
alert(JSON.stringify(err));
http://msdn.microsoft.com/en-us/library/office/jj163876(v=office.15).aspx
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer -
Bug in Notes ? Search for "Apple" highlights almost all Notes.
Hi,
I just discovered that entering the keyword "apple" in the search bar of notes shows me that almost all my notes contain it.
Even though they don't. I checked it many times.
Short notes with only 5 words which cleary dont have the word "apple" are shown for example.
By deleting the notes and rewriting it ( whith "copy&paste" ) the dissappear from the search results.
Is it just me ? I can't imagine this being a bug.
Any Ideas ? Thanks in advance.I am not a Notes user even though I have Mountain Lion and can tell you that what you describe is a very strange bug.
Things to try:
Close Notes application and then reopen the Application and try to find if the error is reproducible.
If the issue persits, reboot your Mac.
File a bug report in the OS X Feedback Page or by creating an Apple Developer Account (Don't worry it's free).
Hope this helps! -
Searching for values of authorization fields
Is there a way to see the transaction codes or programs that makes use of a specific value of an authorization field?
Example: K_PRICE001 has the following authorization fields.
BUKRS - Company Code
WERKS - Plant
CWPRICLABL - Price Type
ACTVT - Activity
The permitted activities are "02" (Change) and "03" (Display).
Can I find programs/transaction codes that use "02" only? or "03" only? or "*" for all?> What it does not do is show you what values are linked to it, that you have to do manually but atleast you would have a list to start with.
Someone already did that and left all the information behind in the system for you - both check indicators (the capability of the transaction to control something) and proposals (the intended use of the transaction).
They also update it with each support package, but it is nor 100% correct not a perfect match for all your intentions. You can use authorizations to tune it if you have set it up correctly in the first place...
--> SU24.
Cheers,
Julius -
Searching for key words in all ABAPs in system
Hi,
Is there a way for me to check for the existence of certain keywords in all customized ABAPs in the system - e.g. very much like doing a global search in Windows?
I'm trying to identifying all ABAPs in my system which matches certain keywords.
Can it be done?
Thanks in advance.Have you tried quoting the search phrase? eg:
"flash drive" -
How do I search for a file across all my macs on my network
I have three macs. Two operate wirelessly, one does not, but they are all part of the same network.
Does anyone know how to search all macs simultaneously for a particular file? I have leopard installed on all macs.
Thanks
BuckApparently, the "Shared" search location button only shows up if you first connect to some 'sharepoint' from the Sidebar "SHARED" list and the sharepoint 'volume' then appears in the Sidebar "DEVICES" list. For me, not all 'volumes' do this -- just those that are really some sub-directory of a remote Mac do, but not (for instance) those that are that Mac's complete, top level startup volume.
BTW, even when the button does show up, the searches are very slow & usually don't find items on the remote Mac that I expect they should.
I think it is a bug, or more accurately an incompletely implemented feature.
Maybe you are looking for
-
HP Officejet 4500 G510n-z Wireless connection prints from Windows Vista but not from Windows 7
HP Officejet 4500 G510n-z printer appears to be connected to my Dell Notebook running Windows 7 on the HP Solution Center page but does not print.Documents just get stuck in the que. It was printing then it wasn't then it was then it wasn't. The prin
-
How do I change alphabetical element listing in xml to nested xml using xslt?
Have an 'Bus Card Request' indd form exported to fillable form pdf (reader enabled etc). Have 'Bus Card Template' indd to receive the BC data from the returned filled pdf form. The tags & structure are identical on both indd docs. The xml exported fr
-
Help! PowerBook G4 failed, rebooted but I have lost all my iTunes files!
Hi there, Please help! I have an old PowerBook G4. I dropped it this morning by accident and it stopped working. I got it to switch on again and got to the Darwin/BSD page. I followed the advice below: Start up in Single User Mode and type carefully:
-
Cannot find my utilities tab on ipad mini (ios 7..0.2)
cannot find my utilities tab on ipad mini (ios 7..0.2) after installing IOS 7.0, I cannot find the Calculator app, and the utility tab in my iPad mini where did they go? tks Flavio
-
I am experiencing a memory leak when I write to a file in a loop.
I am conducting a cycling test, each cycle represents about 48k of memory. I collect a selectable number of cycles into a shift register. When the chosen number of cycles is reached, I write the data to text files and then clear out the shift registe