SQL only: WHERE Condition pulled the correct runtime of the Central "SQL" tab
I have a requirement that seems like it should be easy to solve in SQL, but me seems to be stuck with blinders and can't see the solution.The 'problem' that I'm trying to solve is to get several reporting units to any use of the SQL even in their where clause for certain types of metrics reports. So this is the solution I am proposing that we store the sql in a central table, which, in a simplified form, would have two columns as:
GroupName Varchar2 (2000)
SQL_Filter Varchar2 (5000)
What I want to do conceptual, it's allow the user (even if they're using MS - SQL) to
WHERE FunctionName (GetSQL_ForGroupName)
But first of all, I would tell them that this can be done in Oracle sql. However, I can't understand how to achieve this end. From what I've read so far that oracle will not do:
WHERE (subquery that returns SQL)
or (in SQL)
WHERE VariableSubstition
or
WHERE FunctionName (GetSQL_ForGroupName)
It seems that these things in the WHERE clause allows Oracle after only
FieldName [operator]
as in
WHERE price > (subquery)
or
WHERE ID IN (Value) Function
Is it possible to do a subquery (or anything else) that allows me to draw the where clause running SQL - using only SQL? I can do this with a stored procedure, but it is to say it seems to me I had start coding select specific instructions for them or code so that they could enter select statements (or joins etc.). I don't want to write a complete dynamic reporting engine. I want to do is be able to pull the sql running. This ensures that everyone is 1) with the good sql for metrics 2) by using the same sql and 3) the core sql parameters can be stored in one place instead of 3000 definitions of the various reports.
I must be looking at this the wrong way, I think. The solution does NOT seem to do WHERE (pull in the SQL running)... but I was not able to find a different way of thinking. For example, WITH does not resolve as you immediately the requirement WHERE fieldname [operator] [subquery | function]. I was browsing the internet and looking through all the books SQL on Safari of O'reilly but I have not met a solution. However, I think, this issue of 'centralization of base SQL' must have been resolved several, several times previously. Why can't I find anything on it then?
Brad
You might use a pipeline function to return a TABLE object. This function accepts a parameter that contains the name of the Group (although "GetSQL_ForGroupName" is supposed to represent). The query that they deliver will then look something like this:
SELECT column_list
FROM TABLE(table_function('GroupName'))
WHERE additional_conditions
In the function, you can create the SELECT statement that channels the rows in the table with WHERE conditions pulled a table for the provided group name.
Tags: Database
Similar Questions
-
Hi guys,.
I can't help but feel incompetent when I can't remove the battery from my camera. I maybe just strong fingers, but not for the life of me, I couldn't remove the back panel of my 9700 when I have to reset my camera (I develop a GPS app and had to see the consistency of the time it takes to get the first stand-alone fix). Fortunately, I don't need to remove the battery very often, but I wish I could. Is there a good way to remove the said sign without damaging the unit?
Watch the video to remove the batttery
-
How to question to "view only" on condition?
Hello
I have a page with serveral elements.
When a checkbox is set, the majority of the elements on the page should be "view only" so that they cannot be changed by users.
How is that possible?
Is there a way to automatically set the item property when you set this checkbox - maybe even the 'conditional display?
Thank you!
BR
LenaHave you checked the section 'Read only' after 'Conditions' in the properties of the element?
In the section read-only give the condition type as "point to 1 = exp 2' exp value, give the name of the element in exp 1 and the value of the checkbox in exp2.".
I hope this helps.
-
WHERE condition in a sql statement
Hello people,
I have a screen with data grid where one of the columns is STATES_CODES and other VOLUMES one. Grid consists of several lines. I need to create a CUSTOM SEARCH field that will be filtering on this database.
Unfortunately a customer wants to enter a search string with custom functions: '+' (plus) to include in the selection of the result and "-" (less) to exclude from the selection of the results. For example: "+ IT + -100". Based on this string, I need to return only the States HE and and exclude volumes with a value of 100.
A tip how to build a query where condition, so it will be more effective as possible?
Simple example:
test data:
with t (select 'IT' State, volume 90 of any union double
Select 'IT' State, 100 volumes of all the double union
Select 'IT' State, 100 volumes of all the double union
Select 'OF' State, 90 volume of all the double union
Select 'OF' State, in 100 volumes of all the double union
Select 'OF' State, in 100 volumes of all the double union
Select 'NL' State, 90 volume of all the double union
Select 'NL' State, 100 volumes of all the double union
Select 'NL' State, 100 volumes of all the double union
Select 'FR' State, 90 volume of all the double union
Select 'FR' State, in 100 volumes of all the double union
Select 'FR' State, in 100 volumes of all the double union
Select 'ARE' State, 90 volume of all the double union
Select 'ARE' State, in 100 volumes of all the double union
Select 'ARE' State, 100 volumes of double
)
Select * from t
Search string: "+ IT + - 100".
I thought to somehow using regular expressions REGEXP_LIKE condition, but do not know how to change the entered search string in above format as long as the regular expression.
And if you want to be specific about the characters representing the State and the numbers represent the amount then you will need to divide them into more...
SQL > with t (select 'IT' State, 90 volume of all the double union)
2 Select 'IT' State, 100 volumes of all the double union
3 select 'IT' State, 100 volumes of all the double union
4. Select 'FROM' State, 90 volume of all the double union
5. Select 'FROM' State, in 100 volumes of all the double union
6. Select 'FROM' State, in 100 volumes of all the double union
7 select 'NL' State, 90 volume of all the double union
8 select 'NL' State, 100 volumes of all the double union
9 select 'NL' State, 100 volumes of all the double union
10. Select 'FR' State, 90 volume of all the double union
11. Select 'FR' State, in 100 volumes of all the double union
12. Select 'FR' State, in 100 volumes of all the double union
13. Select 'ARE' State, 90 volume of all the double union
14 select 'ARE' State, in 100 volumes of all the double union
15 select 'ARE' State, in 100 volumes of double
16 )
17, ch. as (select "+ IT + -100"as the double criterion)
18, split as (select regexp_substr (trim (', ' regexp_replace (criteria,'([+ -]) ', ', \1')), "[^,] +', 1, level") as a criterion of)
19 c
20 connect the regexp_substr (trim (', ' regexp_replace (criteria,'([+ -]) ', ', \1')), "[^,] +', 1, level") is not null
21 )
22, inc_state as (select substr(criteria,2) as a criterion
23 split
where the 24 regexp_like(criteria,'^\+[A-Z]+')
25 )
26, inc_vol as (select substr(criteria,2) as a criterion
27 split
where the 28 regexp_like(criteria,'^\+[0-9]+')
29 )
30, exc_state as (select substr(criteria,2) as a criterion
31 split
where the 32 regexp_like(criteria,'^\-[A-Z]+')
33 )
34, exc_vol as (select substr(criteria,2) as a criterion
35 split
where the 36 regexp_like(criteria,'^\-[0-9]+')
37 )
38-
39 select *.
40 t
where the 41 (exists (select 1
inc_state 42
43 where inc_state.criteria = t.state
((44) or (select count (*) in inc_state) = 0)
45 and (exists (select 1
46 by inc_vol
where the 47 inc_vol.criteria = t.volume
((48) or (select count (*) in inc_vol) = 0)
49 and (not exists (select 1
50 to exc_state
where the 51 exc_state.criteria = t.state
((52) or (select count (*) in exc_state) = 0)
53 and (not exists (select 1
exc_vol 54
where the 55 exc_vol.criteria = t.volume
((56) or (select count (*) in exc_vol) = 0)
57.ST VOLUME
-- ----------
HE 90
90 -
How can I pass a condition of the table in the sql statement?
For example, in the table in the COND Varchar2 column (200) there is the value ' VAR > 10'.
| COND |
|' VAR > 10' |
where VAR is the name of the table column. I would like to make statement CASE WHEN VAR > 10 AND 0... I tried with as subquery
WHEN BOX (SELECT COND FROM TABLE WHERE...) THEN 0, but it does not work.
Hello
You can do this by using dynamic SQL.
that is to say:
declare v_stm varchar2(4000); v_cond varchar2(100); v_result integer; begin select cond into v_cond from yourtable where a=1; v_stm := 'select case when '||v_cond||' then 0 ...'; -- dynamic sql execute immediate v_stm into v_result; end; /
Remember that, in general, dynamic SQL has a performance degradation that SQL static and should be avoided when possible.
Storage condition or the SQL statements in the tables is not a good practice.
Kind regards.
Alberto
-
May I ask where clause to satisfy two conditions at the same time (and)
Hello
I wrote a few joins and usually in the final stage where condition with certain conditions be satisfied in where clause. In all conditions where I only want one and condition fulfilled only if both are collected.
If we look at the this funciton is I should meet (get_order_type (ogr.order_number) <>'R')) AND wh1.third_party_warehouse! = 'Y') but I'm not get rid off both that if order_type is 'R' they are removed and if tooling_group is yes then ther are removed the result. I'm trying with both below pointed out together how can check these conditions? I can do in where clause?
((sg.tooling_stock_group <> 'Y'))
and
(get_order_type (ogr.order_number) <>'R'))
Of order_goods_received ogr
LEFT JOIN part_master pm
On ogr.part_number = pm.part_number
-stock_groups sg left join
SG stock_groups left join
on pm.stock_group = sg.stock_group
and ((sg.tooling_stock_group! = 'Y'))
and (get_order_type (ogr.order_number)! = 'R'))
-Pm.stock_group = sg.stock_group
LEFT JOIN batch_record_1 br1
-A FEW MORE CODE HERE-
WHERE ((ogr.delivery_date > = trunc (date_départ)))
AND
((ogr.delivery_date < = trunc (end_date)))
AND
OGR.goods_received_number <>'1' AND
get_order_type (OGR.order_number) NOT IN ('L') AND
OGR.returned_to_supplier_indicator not in('S','L') and
-sg.tooling_stock_group <>'Y '.
-((sg.tooling_stock_group <> 'Y') and (get_order_type (ogr.order_number) not in ('R')))
-(get_order_type (OGR.order_number) <>'R' AND sg.tooling_stock_group <>'Y')
((sg.tooling_stock_group <> 'Y'))
and
(get_order_type (ogr.order_number) <>'R'))
AND wh1.third_party_warehouse! = « Y »
UNION
(
Thank you.
Whenever you have a problem with such logic, you should try and draw a logic state diagram:
In your case, you are looking to two variables, with two possible States (equal to a value or is not it)
Then, take this sense of the sg.tooling_stock_group T and O as being the get_order_type (ogr.order_number) and create a state diagram logical based on your description of what you want. We will use a value of "Y" to indicate we want to record and a value of "N" to indicate the folder should not be returned.
Start with an empty logical diagram...
T = 'Y' T! = « Y »
+---------+---------+
| | |
| | |
| | | O = 'R '.
| | |
| | |
+---------+---------+
| | |
| | |
| | | O! = « R »
| | |
| | |
+---------+---------+First of all, you said: "If there is the result returned by the defined user function is"R"and the table that has the tooling_stock_group y then it should avoid this record."
T = 'Y' T! = « Y »
+---------+---------+
| | |
| | |
| N | | O = 'R '.
| | |
| | |
+---------+---------+
| | |
| | |
| | | O! = « R »
| | |
| | |
+---------+---------+Then you said: "If order_type does not return" R' but the tooling_stock_group is 'Y', then I should not avoid recording ".
T = 'Y' T! = « Y »
+---------+---------+
| | |
| | |
| N | | O = 'R '.
| | |
| | |
+---------+---------+
| | |
| | |
| Y | | O! = « R »
| | |
| | |
+---------+---------+Now, you have not given any logic for the rest of the diagram, so I made the assumption that you do not want to avoid these records...
T = 'Y' T! = « Y »
+---------+---------+
| | |
| | |
| N | Y | O = 'R '.
| | |
| | |
+---------+---------+
| | |
| | |
| Y | Y | O! = « R »
| | |
| | |
+---------+---------+Now there are different ways to determine the location of the clause of this diagram.
We could say that we want the records for all of the T column! = "Y" or all the records for all of the O line! " = R...where (sg.tooling_stock_group! = 'Y' or get_order_type (ogr.order_number)! = 'R')
We say we want to EXCLUDE (using DO NOT) all records where T = "Y" AND O = "O" "
If not (sg.tooling_stock_group = 'Y' and (ogr.order_number) get_order_type = 'R')
Those are the two most logical ways to do.
(In my previous answer, that we can see in this diagram, there is no need of the "or get_order_type (ogr.order_number).) (= 'R' "part, which is superfluous, but would not break it)Now let's look at your logic to see what it looks like to in the diagram...
where ((sg.tooling_stock_group <> «Y»))
and (get_order_type (ogr.order_number) <> 'R')
)In a logic diagram that looks to...
T = 'Y' T! = « Y »
+---------+---------+
| | |
| | |
| N | N | O = 'R '.
| | |
| | |
+---------+---------+
| | |
| | |
| N | Y | O! = « R »
| | |
| | |
+---------+---------+As you can see, your logic was only targeting one of the 4 possible results for select records and excluding 3.
-
Go to dynamic WHERE the condition in the slider accordingly.
Hi all
I am facing a problem with the cursor with dynamic WHERE condition in a function.
Here's the FUNCTION:CREATE OR REPLACE FUNCTION EXCEPTION_MERGE(TABLE_NAME IN VARCHAR2, TAB_NAME IN VARCHAR2) RETURN VARCHAr2 IS stmt_tabcols VARCHAR2(32767); v_columnname VARCHAR2(32767); CURSOR C1 IS SELECT 'A.'||A.COLUMN_NAME ||' = '|| 'B.'||B.COLUMN_NAME COLUMN_NAME FROM ( SELECT COLUMN_ID, COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = TABLE_NAME AND COLUMN_NAME NOT IN ('ERROR_TAB_ID','ERROR_LOAD_DATE') ) A, ( SELECT COLUMN_ID, COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = TAB_NAME ) B WHERE A.COLUMN_ID = B.COLUMN_ID; BEGIN FOR TABCOL IN C1 LOOP stmt_tabcols := stmt_tabcols ||TABCOL.COLUMN_NAME||','; END LOOP; stmt_tabcols := RTRIM(stmt_tabcols, ','); RETURN stmt_tabcols; END;
She throws, below error:SELECT EXCEPTION_MERGE('WC_W_TEST_FS','WC_W_TEST_FS_GBL') FROM DUAL;
If I REPLACE TABLE_NAME table_name with hard coded values, it works fine. Can someone look at the code and let me know the question.ORA-06502 : PL/SQL : Numeric or value error : character string buffer too small
Published by: ace_friends22 on Sep 9, 2012 13:08The first function TABLE_NAME parameter has the same name as the column of USER_TAB_COLUMNS...
Change the names of the parameters to say nom_table_p...Concerning
Etbin
-
Query on calculated field where deletes conditions of the clause
Hi gurus,
Under a new requirement, we have created a new field calculated in Contact before JC, which removes the condition from which to extract the clause and made full table.
Requirement:
We have a field in the user interface, that has data like "J1234" or "K44335". Customer won't see the first character of the alphabet of these data.
Solution, we have developed:
(1) create a new calculated field 'ABC person UId Calc' as follows.
Name: ABC person UId Calc
Calculated: true
Computed value: right ([nobody UId], Len([Person UId]) - 1).
(2) exposed this field in the user interface.
Question:
When the user queries in the applet for this field, the generated SQL code has no condition in a Where Clause to the query on PERSON_UID.
SQL has earlier been something like...
(T25. EMP_FLG = 'N') AND (T25. PERSON_UID LIKE: 3)
But after you make this change, the current SQL is trimmed of the just
(T25. EMP_FLG = 'N')
This means that this isn't question with PERSON_UID, resulting in an impact huge performance.
If someone could suggest on this issue, to the difficulty.
ConcerningOh sorry, I guess I missed something.
I guess the simplest solution is to store the values of redundantly (A, B the value of the value and the value of A + B) and stop using a calculated field.
You could script something in the PreQuery event, but I think it's an ugly hack.
-
I have an iMac (2015). When I open Garageband, there are only two buttons on the control bar, play and stop. No record button, rewind or ff. Where are they and how can I make it appear?
Try to enlarge the GarageBand window by dragging the corners of resizing.
If she looks like this, your window is small:
You can also try to click the double arrow at the end of the toolbar to reveal more options.
-
Computer crashes randomly. The only thing you can do is to pull the plug so it can restart
I am running Windows XP on a HP Media Center PC. The system started to freeze frequently and randomly. The only thing you can do is to pull the plug.
I got it in an "expert" they checked for virus added Ram etc but could not find anything wrong. Brought it home and it froze in the first ten minutes.
I am running Windows XP on a HP Media Center PC. The system started to freeze frequently and randomly. The only thing you can do is to pull the plug.
I got it in an "expert" they checked for virus added Ram etc but could not find anything wrong. Brought it home and it froze in the first ten minutes.
========================================
At the "Expert" mention that the system could be overheating?Perhaps the following would offer a few ideas:
Detect and repair a computer overheating
http://www.computertooslow.com/overheating-computer.aspClean your computer tower
http://www.computertooslow.com/clean-computer.aspHow to clean the inside of a computer case
http://www.technibble.com/how-to-clean-the-inside-of-a-computer-case/Why my Toshiba laptop suddenly stops by itself without warning?
http://www.laptoprepair101.com/laptop/2006/01/04/Toshiba-laptop-overheating/How to stop laptop overheating problems
http://www.computer-Adviser.com/stop-laptop-overheating.htmlLaptop overheating problems - the easy cure
http://EzineArticles.com/?laptop-overheating-problems---the-easy-cure&ID=1269144Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.
-
my hp presario says 'boot mrg is missing' and only load windows 7 can correct with the recovery disk
my hp presario says 'boot mrg is missing' and only load windows 7 can correct with the recovery disk
Hello
Here is the vista forums
Try the repost in Forum windows 7 the link below
http://answers.Microsoft.com/en-us/Windows/default.aspx#tab=2
Answers by topic
- Office & Customization
- Files, folders, & search
- Game
- Hardware drivers &
- Install, upgrade, and activate
- Internet Explorer
- Music & Sound
- Networking, mail, electronic, & updated online
- Maintenance & performance
- Photos & Video
- Programs
- Security, privacy, and user accounts
- System repair & recovery
- TV and movies on Windows
- Windows Update
-
How/where to buy the Windows 7 activation key only?
How/where to buy the Windows 7 activation key only?
Unfortunately, digital downloads of Windows 7 no longer exist. It was the only way you could have acquired Windows 7 as a key of product only.
Where can I still get Windows 7?
Full version - Microsoft Windows 7 Home Premium
Microsoft Windows 7 Ultimate - full version
Full version - Microsoft Windows 7 Professional
Version upgrade - Microsoft Windows 7 Professional Upgrade
Version upgrade - Microsoft Windows 7 Ultimate Upgrade
Version upgrade - Microsoft Windows 7 Home Premium Upgrade
Family Pack: Upgrade of Microsoft Windows 7 Home Premium Family Pack (3 users)
-
Where to find the correct SHA1 checksum for the upgrade Pro Windows 8 ISO?
I ordered the Windows 8 Pro upgrade online. (not a preview but the new product on 26/10/12). I downloaded and burned the ISO of the English version of the Windows 8 ISO file. I'm assuming that 64-bit. This took place without incident. I started the upgrade on a PC running Windows 7 SP1 64-bit, but it failed during the installation phase of Windows 8 to 72% with the error "installing Windows 8 failed".
So I restarted the upgrade and it has not exactly in the same place (72%) and the same cryptic error.So I contacted the Microsoft Store and they helped me to go through the process of downloading a 2nd time. The 2nd ISO file was exactly the same size, BUT it had a different SHA1 checksum!Then I tried the upgrade using the new DVD burned in the 2nd ISO file and it failed at exactly at the same stage of the upgrade (72%).So I got two corrupt downloads / Burns? I have no way to tell because all I know is that they have different amounts of control.Maybe they all are both wrong, or maybe the question is something else entirely.But first things first. How can I determine if my ISO file is correct?What is the checksum SHA1 of a non-corrupt ISO file? Where to find the information online?I have the same problem with my 64-bit windows English version.
I created a bootable DVD from iso and started to install a clean install by formatting the hard drive.Installation will be stuck at 17% and it happened to me like 3 times and I burned a fresh DVD and always the same question.It's like the worst level ever... Is there a way I can download an iso of 64-bit bootable DVD and use it to upgrade? -
Since the last update when importing image directly in Lightroom, metadata display the correct focal length, but will not display any information from the lens, Lightroom reports only as 'unknown lens', the info from the lens is in the meta-data... When you change an image in LR in PS then save, lens Info appears as if by magic. This is a problem of workflow for those who could use multiple lenses on a shoot... What is the status on this issue? I shoot with Nikon D800... thnx ted-lens-metadata-field-missing-on-import?topic-reply-list[settings][filter_by]=company_promo https://feedback.photoshop.com/photoshop_family/topics/camera-raw-9-5-lens-information-aux I posted this on FB with LIGHTROOM page, they instructed me to send you. Needless to say that it is a huge problem for the workflow, and reduce my bright room isn't an option because whenever he do it takes two days to arrive, and I have no time to lose if I appreciate some type of response as soon as possible
What is the status on this issue?
The link you gave clearly indicates the status of this issue. Adobe is working on it.
-
Where to write the condition in the design of workflows with conditional step?
HelloAgain, I wish BP and workflow with contitional design stage.
I had designed BP and workflow.
As directed by the user for Udesigner guide, I had added trigger before the condition step.
But I do not understand where to set the Condition to test?
If I need to write the condition in triggering elemt itsel... How to proceed?
for example, I want to write the condition as cost of Tota > = 100000, it must follow a path and if fails to another path.
The conditions of triggers are specified in the workflow settings. After you have created a new configuration, open it and click on the settings tab. You will see a tree structure of the workflow with conditional branches. Click a conditional branch to set the parameters for the trigger for this route condition.
Maybe you are looking for
-
Windows Update windows 10 freeze when Skype opens... again
First posted about it here http://community.Skype.com/T5/Windows-desktop-client/Skype-sign-in-freezes-Windows-10/m-p/4302090 Update my drivers worked, but last night there was a windows update and now Skype loading makes my pc freeze again. Have upda
-
LabVIEW 2015, some of the Excel worksheet data moving to another Excel sheet
Hi, guys. I want to achieve functional on the transfer of data between the Excel sheet. For example I get addresses of the cell, then the data in the passage of the address to the other Excel sheet a particular cell. What can I do? Thank you.
-
Windows Setup has not finished.
Hello I reinstall Windows XP on a Dell Dimension 4500 with a Dell Windows XP Pro SP3 recovery disk. I followed all the steps to reinstall. I deleted the old partition and installed chose NTFS quick format. The installation went fairly smooth until I
-
6 months Aspire one D270, "plug-in, do not load ' help me!
The battery is 0% @ the moment and refusing to load. Telling me to connect in, not charging hav try withdrawal d battery, change of source of power load and even leave the rest of the laptop for days now. Still not supported, please help me.Thanks in
-
How to set up LAN wireless and wired for simultaneous operation
I use a Lenovo thinkpad running windows XP. I want to set up an independent network so that I can connect my hardware for debugging. At the same time, I want to be able to access the corporate network using the wireless interface. My autonomous netw