How to set a null column in a where clause clause involving a statement box
In oracle APEX, I a (selection list) element called: P32_STATUS. It contains two values of interest (for this discussion): 'Available' and 'checked '. In my report, I have a column called vc_status that contains two values: "Checkbox" and NULL. In my application I want to use a case statement in my where clause similar to the lines of
where
.
.
.
AND (vc_status = CASE WHEN: P32_STATUS = "Checkbox" THEN : P32_STATUS )
WHEN : P32_STATUS = 'Available' THEN NULL END)
The 'box' filtering works but the filtering to try to vc_status the NULL value does not work. Can someone help me? Thank you!
(P.S. My intuition says that there because I can not put vc_status = NULL, but I must say that vc_status IS NULL... However, I don't know how to do execution IS ZERO inside a CASE statement)
Hello
Your intuition is right...
In Oracle NULL is a bit special:
NULL = NULL is false
NULL <> NULL is false
Thus, instead of the parameter a NULL value in the CASE WHERE there is just set a value on the other side:
NVL (vc_statut, 'Available') =: P32_STATUS
That's all! Simple, clean and functional
Tags: Business Intelligence
Similar Questions
-
'create columns with a where clause' in MDB
Hi all
I have a question on the OBI EE meta data layer.
We have OBIEE sitting on a with a star schema data warehouse.
Our fact table contains the following fields...
EmployeeID
CompanyID
ID of the measure
The measure name
MEASURE
That's what we have in the physical layer, layer MDB and the presentation layer, but I want to be able to "create columns with a where clause.
So my table of facts in the presentation layer would look like this
Quantity sold
Unit cost
Amount of the company
I thought I could just create a logical with column
Quantity = measurement
where as name = "quantity".
But I can't find any to do so.
Any ideas?
Thank youHello
I think that what you want to achieve must be done in the physical layer and not the business layer.
Instead of using your physical table directly from the DB, you must create a physical table based on an SQL statement.
GO to the physical layer you / create the new object table in Table type choose "Select" and then you write your select statement as you want.
Once this is done to create your physical joins and import your table into your business layer and create your complex joins
This should do the trick.
It may be usefulConcerning
-
How to find the NULL columns in the table?
Hello
Please provide the query to search for null columns in the table. Here, all the rows in the table have same column as null. It will not change.
Table
---------------
C1 c2 c3 c4
X C 10
T D 20
I want to know that C2 is the nullable column.
Thanks in advance!
Kind regards
Florian...A variance more
create or replace function is_nulled_column(tab varchar2, col varchar2) return varchar2 is cnt number:=1; begin execute immediate 'select count(1) from '||tab||' where '||col||' is not null and rownum=1' into cnt; return case when cnt=0 then 'Y' else 'N' end; end;
and use:
select c.OWNER,c.TABLE_NAME,c.COLUMN_NAME,c.NULLABLE,is_nulled_column(c.TABLE_NAME,c.COLUMN_NAME) all_nulls from all_tab_columns c where c.OWNER=user and c.TABLE_NAME like '%' order by c.OWNER,c.TABLE_NAME,c.COLUMN_ID
-
Details on the order of columns in a Where Clause
Thank youHi All My both Quarries are giving same record count . so can i say that the order of the columns("msib.inventory_item_id=pol.item_id" AND" pol.item_id=msib.inventory_item_id ") in the where clause doesn't effect the query result in any situation {code } select count(*) from po_headers_all poh ,po_vendors pv ,po_lines_all pol ,po_line_locations_all pll ,mtl_system_items_b msib where poh.vendor_id = pv.vendor_id and poh.po_header_id = pol.po_header_id and pol.po_line_id = pll.po_line_id and pll.ship_to_organization_id = msib.organization_id ----------------1 and msib.inventory_item_id=pol.item_id --------------------------2 and poh.type_lookup_code = 'STANDARD' and pv.vendor_name = 'Star Gate Ltd' group by 1 select count(*) from po_headers_all poh ,po_vendors pv ,po_lines_all pol ,po_line_locations_all pll ,mtl_system_items_b msib where poh.vendor_id = pv.vendor_id and poh.po_header_id = pol.po_header_id and pol.po_line_id = pll.po_line_id and pol.item_id = msib.inventory_item_id ----------------------------------2 and pll.ship_to_organization_id = msib.organization_id -----------------------------1 and poh.type_lookup_code = 'STANDARD' and pv.vendor_name = 'Star Gate Ltd'
Published by: vijay539 on November 20, 2009 09:17
Published by: vijay539 on November 20, 2009 09:18
Published by: vijay539 on November 20, 2009 09:19
Published by: vijay539 on November 20, 2009 09:19Hello
Right; the order in which the columns appear in the SELECT clause has nothing to do with the lines that are in the result set.
In fact, unless you say SELECT DISTINCT , I don't think there's anything (except to trigger an error) you can do in the SELECT clause, which would change the lines are selected.
Published by: Frank Kulash, November 20, 2009 12:45
Sorry, I misread the question. You may have about the order of the conditions in the WHERE clause, not the SELECT clause.
The answer in short is the same:
Right.Unless you mix ANDS and ORs (no one should ever do and that you are not), the order of the conditions will make no difference in the results.
-
How to set up excel column width
I use the ExcelRpt_SetCellRangeAttribute function to set the width of a cell in excel.
What vale I should switch to set the width for example 50, I tried to transmit values, but his does not work.
After passing the values'm specifying the column containing the cell is hidden.
pls help me
Hello!
I modified the sample project "excel2000dem.prj" come with the installation of LabWindows/CVI to see if I can adjust the width of the column that you have requested.
Following the partial code successfully set the column width to 15.0 points in MS Excel 2003.
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#define EXCEL_ARRAY_OF_CELLS "A2:H11".
...
public static ExcelObj_App ExcelAppHandle = 0;
public static ExcelObj_Workbooks ExcelWorkbooksHandle = 0;
public static ExcelObj_Workbook ExcelWorkbookHandle = 0;
public static ExcelObj_Window ExcelWindowHandle = 0;
public static ExcelObj_Sheets ExcelSheetsHandle = 0;
public static ExcelObj_Worksheet ExcelWorksheetHandle = 0;
public static ExcelObj_Range ExcelRangeHandle = 0;public static MyCellRangeV VARIANT;
....... (I assume that you have an open Excel application and an active workbook already)...
{
Get the sheets in the active workbook
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppSheets, CAVT_OBJHANDLE, & ExcelSheetsHandle);
Get the first worksheet
error = Excel_SheetsItem (ExcelSheetsHandle, NULL, CA_VariantInt (1), & ExcelWorksheetHandle);
The first sheet Active - should already be active
error = Excel_WorksheetActivate (ExcelWorksheetHandle, NULL);New range open to the worksheet
error = CA_VariantSetCString (& MyCellRangeV, EXCEL_ARRAY_OF_CELLS);
error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, & ExcelRangeHandle);Make the range Active
error = Excel_RangeActivate (ExcelRangeHandle, & ErrorInfo, NULL);Set column width
error = Excel_SetProperty (ExcelRangeHandle, & ErrorInfo, Excel_RangeColumnWidth, CAVT_DOUBLE, 15.0);..........
}//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Let us know if it works for you.
-
Interactive report - how to set the default columns displayed
Env: APEX 4.1
For example, at the beginning, I created the reprot source as select c1, c2, c3 from t; later, I added c4. But I was unable to figure out how to do c1, c2, c3, c4 become the columns displayed default. I always have to click on Action-> select columns, and then move the C4 "do not display" to "report view". Any clue?
Thank you
DenisAfter choosing the columns (and the other changes you want)
go to Actions > save the report > save as default report > primary, click [apply]
I am on 4.1.1.00.23 and simply exercised these steps successfully with one of my IR
If this does not work, I don't know what else to say. (If you are not connected to the Application Builder, you don't not even the default save option)
-
How to set a dynamic column to count the quarter of each year?
Lets see the result which now displayed:
The problem is about how Dynamic a new column called 'Q_count' to count each displayed line belong to which quarter of the year?YEARS MONTHS SUMMONTH SUMYEAR SUMQUARTER ----- ------ -------- ------- ---------- 2009 Jan 127994 1766166 449652 2009 Feb 168106 1766166 449652 2009 Mar 153552 1766166 449652 2009 Apr 160329 1766166 438913 2009 May 137605 1766166 438913 2009 Jun 140979 1766166 438913 2009 Jul 148606 1766166 435283 2009 Aug 150390 1766166 435283 2009 Sep 136287 1766166 435283 2009 Oct 149529 1766166 442318 2009 Nov 153268 1766166 442318 2009 Dec 139521 1766166 442318 2010 Jan 124670 1721212 407181 2010 Feb 139278 1721212 407181 2010 Mar 143233 1721212 407181 2010 Apr 149518 1721212 444112 2010 May 152292 1721212 444112 2010 Jun 142302 1721212 444112 2010 Jul 149125 1721212 412855 2010 Aug 130328 1721212 412855 2010 Sep 133402 1721212 412855 2010 Oct 157754 1721212 457064 2010 Nov 137078 1721212 457064 2010 Dec 162232 1721212 457064
In addition, she repeats once again next year.
For example:
* Jan - Mar 2009 will show "q1", Apr - Jun will display 'q2'... and 2010 Jan - Mar, he will again show "q1" and so will guess
Here is my sql I use:
Thanks everybody helps me!select years,months,summonth,sumyear,sumquarter from( select years,months,summonth,sumyear, sum(sumhour) over(partition by years || to_char(ym, 'Q') order by years || to_char(ym, 'Q')) sumquarter,ym from( select years, months, days, hours, mins, sumHour, SUM (sumHour) OVER (PARTITION BY years,months,days) sumDay, SUM (sumHour) OVER (PARTITION BY years,months) sumMonth, SUM (sumHour) OVER (PARTITION BY years) sumyear, to_date(years || months, 'YYYYMon', 'NLS_DATE_LANGUAGE=American') ym from (SELECT x.years, x.months, x.days, x.hours, x.mins, sum(x.value) as sumHour FROM xmltest, XMLTABLE ('$d/cdata/name' passing xmldoc as "d" COLUMNS years integer path 'year', months varchar(3) path 'month', days varchar(2) path 'day', hours varchar(2) path 'hour', mins varchar(2) path 'minute', value float path 'value' ) as X group by x.years, x.months, x.days, x.hours, x.mins order by x.years, x.months, x.days ) ) ) group by years,months,summonth,sumyear,sumquarter,ym order by ym
Hello
TO_CHAR ( TO_DATE (months, 'Mon') , '"q"Q' )
Returns a string of characters 2 'T1', '2', "q3" or "q4" as you asked for it.
You can use it in your main SELECT clause. -
How to set a null value in the calculation section?
is this possible? What is the correct syntax?or use the "body of the function returning a Boolean" and use
return null;
Scott
-
Compare two tables that have columns of nulls and undesirable in where clause
Table A:
col1 col2 COL3 COL4 col5 col6 ANY
NULL VALUE
NULL VALUE
YES
YES
YES
NULL VALUE
NULL VALUE
YES
NULL VALUE
YES
YES
NULL VALUE
ANY
YES
ANY
NULL VALUE
YES
NULL VALUE
NULL VALUE
ANY
YES
YES
YES
Table B:
col1 col2 COL3 COL4 col5 col6 ANY
NULL VALUE
NULL VALUE
YES
ANY
YES
ANY
NULL VALUE
YES
NULL VALUE
YES
YES
NULL VALUE
ANY
YES
NULL VALUE
NULL VALUE
YES
ANY
NULL VALUE
ANY
YES
YES
NULL VALUE
column values
Yes: Current value
No: Null
All: Junk
Must match all columns in TableA to TableB.
TableA.col1 to TableB.col1
.
.
.
TableA.col6 to TableB.col6
Any help is very appreciated
Thank you
Based on your last post that only good data must match exactly and your definition of junk:
WHERE (decode (substr (A.col5, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ', "junk," A.col5 ") = decode (substr (B.col5, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ',"junk", B.col5"))
AND (decode (substr (A.col6, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ', "junk," A.col6 ") = decode (substr (B.col6, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ',"junk", B.col6"))
And so on for the six columns. This assumes that this junk * still * starts with a ~. In addition, it assumes that the unnecessary and null words are not in the form of good data.
-
How to set the text to align with their base line, not their bounding box?
Left: ' vertical align text to bottom'ed with black outline box
Right: manually move the text with a smart guide to align with its base line. (what I want to achieve)
As you can see in the left, text has its baseline under him, and his rectangle encompassing does not correspond to its base line. When I use align, it does not align with its base line but his rectangle encompassing.
How can I make the text line up easily using their base line?
You can actually get align text, but the method to make some features using the majority of people do not know:
- Select type > effect > path > describe the object
- in the preferences to put a brake on the front of the preview limits use
-
How to set the interval of validation after n lines when generating insert statements?
Hello
I'm trying to script sql insert with a few lines of million using SQL Developer 1.5.4.
I can generate scripts insert ok, but can not see anywhere to set the interval of validation.
In the form of preferences in respect of migration, I see that you can set the interval of validation under data move options, but I guess that's something different.
I know we could use sql loader, but this insert is part of the deployment package that has a series of sql scripts that we run together. So I don't want to run a series of sql scripts, and then run sql loader and then go back to sql scripts.
Am I missing something, or is it simply not possible with SQL Developer?
Thanks in advance for your help,
PeteAssuming that you create the insert using the export as Insert feature script, so no way to to do.
However, once you have generated the SQL to insert script, it is quite easy to add a line at the top that says "set autocommit
", who will then commit automatically after the DML statements successfully . It would probably have a commit and disable autocommit at the end of the script, in the case where the following script awaits undertakes to behave differently. theFurryOne
-
How to set a field to the screen where I want
Ma have a nice one for all
Here I have a prob is that I keywordFilterField.getKeywordField () and keywordFilterField in my screen when I scroll "keywordFilterField.getKeywordField ()" also go to accrding to the list, but here I want to Scrool only to list items to please help me in this regard.
I got the answer I added this field to title
-
Columns in the WHERE clause - order affect the output?
I work on some queries to feed a DWH and stumbled upon this question. Let's say I have this query:
The exit will happen anyway if I do like this:(SELECT ARTREGNROS FROM gx.artabo aa,gx.toccab tc1 where aa.artid=tc1.artid and t.tocid=tc1.tocid and aa.abocod=c.abocod and aa.artconcod=c.concod and aa.percod=a.percod and aa.ArtAboFlgA='S' ) Tarjeta
I guess what he used, or at least I him did not change with the data that I use, but I thought to check here once just to have peace of mind. Maybe it's not the happiest example, but I guess the question is clear(SELECT ARTREGNROS FROM gx.artabo aa,gx.toccab tc1 where aa.artid=tc1.artid and a.percod=aa.percod and aa.ArtAboFlgA='S and tc1.tocid=t.tocid and c.abocod=aa.abocod and aa.artconcod=c.concod ) Tarjeta
No difference.
-
How to put the 2nd column 1st column in excel
Hello
I have a question how to set the 2nd column 1st column in excel. Thank you.
Why the 1 iteration for loops?
Why two Index tables? He's just trying to solve the problem created by the loops For on the original 1 d arrays.
Two of these things create 2D tables which are what complicates things and can be eliminated.
You can take your 2 1 d tables, use build table and right-click to set 'concatenate the inputs.
If you have a 2D array, you can use table remodel to make a 1 column of the table of N line 2D.
-
How to solve where clause matter when it can have a value or be null.
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Hello, I am trying to understand how a query in which I have a where clause clause that can be null or a value, that is to say:
In the query, the gbl variables can have a value or be null, based on the results of a previous cursor. The problem is that if they have the value NULL, I don't get the correct results because where clause will have to be modified to be checked IS NULL instead of = gbl. Is it possible to do it by modifying select it?SELECT supply, duration, count, action FROM MDR WHERE (client = gbl_client OR (group = gbl_group AND section = gbl_section )) AND (prov_code = gbl_prov_code );
Hello
Because these columns are all strings, the CONCAT method will work fine:
SELECT * FROM mdr WHERE '?' || grp = '?' || glb_grp -- GROUP is not a good column name AND '?' || section = '?' || glb_section AND '?' || prov_code = '?' || prov_code ;
I think that the code is a little nicer with the '?' before the actual data. No matter whether it is before or after, just be consistent.
Published by: Frank Kulash, January 25, 2011 15:59
Maybe you are looking for
-
I'm trying to put a background on the theme on my front, I know that you can drag and drop pictures on the front, but you can't put controls or buttons on the image because then always end up going under the image. can anyone help with this? Thank yo
-
Microsoft Word Pad upgrade to Microsoft Word
Recently, I loaded Microsoft Office with Word in my computer. Now when I try to open previous documents that were sent by e-mail, it opens it in Microsoft Word Pad. How can I prevent the documents to open in Microsoft Word, but now in Microsoft Word?
-
HP pavilion G4: help with power on password
I forgot my password on. Disabled system code: 52647759. Help, please. Thank you
-
Update Windows and everything is too big now.
Update Windows and now the internet windows, icons and task bar are all too big. Have tried to reset for all sizes and nothing works. Any advice would be great. Thank you!
-
Windows 7 ultimate is not connecting to wifi. Help, please
After you install the ultimate edition of Windows 7, I am unable to connect wifiAfter a repair he said windows found a driver for network adepterwhere to find the drivers for my laptopmy laptop is 1303au computer hp laptop pavilion g4