Reg: Search for nullable columns
Hi allI have a DIAGNOSIS table that has a QDESC as a nullable column.
DIAGCODE and SDESC columns are not nullable.
I wrote a stored procedure to retrieve the records from the table of DIAGNOSIS based on the values of columns specified.
P_ < nom_de_colonne > indicates that the parameter passed to the stored procedure
Correspong SQL statement goes as follows.
SELECT * DIAGNOSTIC
WHERE
UPPER (DIAGCODE) AS
(CASE WHEN LENGTH (p_DIAGCODE) > 0 THEN '%' |) Upper (p_DIAGCODE) | '%' ELSE '%' END)
AND UPPER (SDESC) AS
(CASE WHEN LENGTH (p_SDESC) > 0 THEN '%' |) Upper (p_SDESC) | '%' ELSE '%' END)
-QDESC is a nullable field; but the following logic doesn't :-(
AND UPPER (QDESC) AS
(CASE WHEN LENGTH (p_QDESC) > 0 THEN '%' |) Upper (p_QDESC) | '%' ELSE '%' END)
Examples of data in the table is as follows.
DIAGCODE SDESC QDESC
--------------- ------------ ------------
123 / / DESC 1 AAA
123 / / DESC 2
123 / / DESC 3 BBB
123 / / DESC 4
When I use the query above to search for records with DIAGCODE like 123, I get
DIAGCODE SDESC QDESC
--------------- ------------ ------------
123 / / DESC 1 AAA
123 / / DESC 3 BBB
That is to say QDESC with null values are not displayed.
How am I supposed to change the query to get the correct result?
Any help would be much appreciated.
Thank you best regards n,.
Tanuja
There are several illusions here.
First of all: SQL has a logic to three values: TRUE, FALSE and NULL. The result of any operator is TRUE or FALSE and that you can only search for NULL values explicitly using IS NULL.
Second: You need the dynamic SQL statements: immediate execution or dbms_SQL. Your variable is a column name, not a constant, if you need to build a string that contains the required SQL statement and present the use execute sql immediately or dynamics.
This will reduce scalability.
Third: < function name > < some constant > = (column) will ensure that any index on < column > is not used.
Usually, this will result in catastrophic performance.
-----
Sybrand Bakker
Senior Oracle DBA
Tags: Database
Similar Questions
-
The search for Clob columns in interactive report
I use APEX 3.2 with 10g. I have an interactive report with a query that takes several recordings of 'comments' and the concatenates using a function that returns a Clob. In the report, there are several of these comments columns mixed with some small varchar2 columns.
Using the search bar, if I type in a Word and click OK, it does not seek my Clob columns. On the other hand, I can use the drop-down list in the search bar to indicate I want to only search one of these Clob columns, then the research works.
Is there a reason that my filters 'Text line contains' do not include my Clob columns? I have defined, as the "Standard report column" and they all "filter" checked as a permitted operation.
GregI found a work around for this problem. IR reports do not seem to automatically search for CLOB columns as a search ROWTEXT (unless you are specifically targeting this column). So, I wrapped the CLOB column with:
DBMS_LOB.substr(clob_column_name,4000,1)
This converts the CLOB Varchar2 column, which made the report «see» IR Of course, this only works if you want to search for the first 4000 bytes, but the data in my CLOB columns are never more than a few sentences long.
-
Hello
I need a little faovour... I need search a pariticular table column value... !! Whenever my superiors asking
What table with that value... This value... etc... !!!
For this I need a solution... (select query). If I give the value name and the column of the table... I can't what column having this perticular value? is this possible? I have many tables and each table has many columns. It takes a lot of time to search for a value of column for each table and columns. Please give me a nice solution.
Thanks to the adv.
Concerning
Rekhafor number
SQL> select table_name, column_name 2 from (select rownum,table_name, column_name, 3 dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" = &val') x 4 from user_tab_columns where data_type='NUMBER' 5 ) where length(x)!=0 6 / Enter value for val: 3000 old 3: dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" =&val') x new 3: dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" =3000') x TABLE_NAME COLUMN_NAME ------------------------------ ------------------------------ EMP SAL TID SAL 7 rows selected. SQL>
for varchar2
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> select table_name, column_name 2 from (select rownum,table_name, column_name, 3 dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" = ''&val''') x 4 from user_tab_columns where data_type='VARCHAR2' 5 ) where length(x)!=0 6 / Enter value for val: OPERATIONS old 3: dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" =''&val''') new 3: dbms_xmlgen.getxml('select 1 from "'||table_name||'" where "'||column_name||'" =''OPERATIO TABLE_NAME COLUMN_NAME ------------------------------ ------------------------------ DEPT DNAME SQL>
-
Hi all
I have about 50 tables in a schema ABC
I am looking for a column of perticualar like XYZ
As my tables contain huge data, is it possible to search this perticualr column
can someone sugest me please.
Thank youHello
To find the tables in the schema of the CBA who have a column named XYZ:
SELECT table_name FROM all_tab_columns WHERE owner = 'ABC' -- Case sensitive! AND column_name = 'XYZ' -- Case sensitive! ;
Published by: Frank Kulash, November 18, 2011 17:20
-
Search for a specific column to a large database entry
So our program manager approached me today looking for the combination of the specific table/column and its referential integrity that contains several entries in the column with the value 'AMSA.
Our database has 4000 + tables so I'll try to track down one by one to which table has these entries, but does anyone know a quick search for this tool?
Hello
Will you please check the following and whether it is useful and important, wort can be run in your target database.
With the following query, you would be able to get the "select" statements to find in each table. column, at the entrance of the AMSA.
WITH CANDIDATE_TABLES AS (SELECT OWNER, TABLE_NAME, COLUMN_NAME, DATA_TYPE, DATA_LENGTH FROM DBA_TAB_COLUMNS WHERE OWNER IN ('OWNER1') /* <<<<<<<<<< PUT ALL SCHEMAS, COMMA SEPARATED >>>>>>>> */ AND (DATA_TYPE LIKE '%CHAR%' AND DATA_LENGTH > 3) /* because AMSA has more than 3 chars*/ AND TABLE_NAME NOT LIKE 'BIN$%$0' AND (OWNER,TABLE_NAME) NOT IN (SELECT OWNER,TABLE_NAME FROM DBA_TABLES WHERE TEMPORARY='Y' UNION SELECT OWNER,TABLE_NAME FROM DBA_EXTERNAL_TABLES) ) SELECT 'SELECT /*+ PARALLEL(4) */ '||''''||OWNER||'|'||TABLE_NAME||'|'||COLUMN_NAME||''''||' AS OWNER_TABLE_COLUMN'|| ' FROM '||OWNER||'.'||TABLE_NAME||' WHERE INSTR(UPPER('||COLUMN_NAME||'),'||''''||'AMSA'||''''||',1) > 0 AND ROWNUM < 2 UNION ALL' STMT FROM CANDIDATE_TABLES C ;
The query above returns phrases such as:
SELECT /*+ PARALLEL(4) */ 'OWNER1|TABLE1|COLUMN1' AS OWNER_TABLE_COLUMN FROM OWNER1.TABLE1 WHERE INSTR(UPPER(COLUMN1),'AMSA',1) > 0 AND ROWNUM < 2 UNION ALL SELECT /*+ PARALLEL(4) */ 'OWNER1|TABLE1|COLUMN2' AS OWNER_TABLE_COLUMN FROM OWNER1.TABLE1 WHERE INSTR(UPPER(COLUMN2),'AMSA',1) > 0 AND ROWNUM < 2 UNION ALL <<
>> Note: Remove the last "UNION ALL"
When the final query is complete, the final result is as follows (a reel in a file):
OWNER1|TABLE1|COLUMN1 OWNER1|TABLE1|COLUMN2 .... .... OWNERX|TABLEX|COLUMNX
Ensure that phrases using in parallel and could be dangerous for a transactional database. First, do a little test.
Spool the output to a file.
Kind regards
Juan M
-
contains the clause in the search for interactive report of a clob column
Hello
I use the Version APEX 4.2.4.00.08
How to use an interactive report contains the when searching a clob column so that it uses the CONTEXT index?
Thank you
Chandra.
I wrote it in the SQL used for IR
I created an APEX application that stores all our it's the HOWTO documents. (word, excel, pdf)
ctx_doc.snippet creates the HTML code.
select D.doc_id ,D.doc_filename ,dbms_lob.getLength( D.doc_blob ) as download ,decode( :P12_SEARCH, null, '-- nothing --', ctx_doc.snippet( 'IT_DATA.DOC_CTX_IX' -- my Oracle Text index name , D.doc_id, :P12_SEARCH ) ) as snippet from it_data.documents D where :P12_SEARCH is null or contains( D.doc_blob, :P12_SEARCH ) > 0
MK
-
Code search for column in html page
I need code to search for a single column of a simple html page with 1700 family names. Something that works similar looking for a name in 'Contacts' on a mac.
Meanwhile, you can use your browser built in search (Ctrl + F). In the search bar, type Young. Moves to the first instance of the same name.
Nancy O.
-
(1) open a library "show all bookmarks".
(2) search for any article you know is there, but you don't know where he is among the Favorites.
3) click on any element in the resulting list.
(4) you will see a lot of information about the item (bookmark), you clicked on.What you want * NOT * see is this very important piece of information: the LOCATION IN THE LIBRARY OF THIS BOOKMARK.
Where this bookmark is placed in the library? In what folder/subfolder?
I invite the developers of FireFox to add this info. Please...
Thank you!
There is an add-on for this:
https://addons.Mozilla.org/firefox/addon/show-parent-folder/
After installation and activation of the extension, Parent folder must appear on the list of columns in the Library dialog box.
If you want to see the full hierarchy the bookmark rather that just the name of the folder, you can set the page modules. Either:
- CTRL + SHIFT + a
- "3-bar" menu button (or tools) > Add-ons
In the left column, click Extensions. Find show Parent folder on the right, then click on the Options button.
Note: The extension was created more than 7 years ago and he's still not a built-in feature, so please don't hold your breath!
-
Search for ducts took my address bar.
If I type anything in the address bar, links to bing search for Web sites come to the top. If I make a mistake in the address, I am sent to bing.
Antivirus scan detects no problem. Ad-aware updates a Win32 file in quarantine, but it doesn't have an impact on the problem of address bar. I have NOT add software add-ons, toolbars tools or winzip on my computer.
I followed the instructions here: https://support.mozilla.org/en-US/questions/919624 and my problem has been resolved for a few days, now it's back. I have not downloaded anything new, but my computer ran two automatic updates.
You view the integrated Firefox search bar? In General, the address bar after your selection there. By default, the selection is Google (you will see the small g on a blue square).
To put your search providers to their values by default (e.g., Google), you can also use this extension as a solution in one step:
https://addons.Mozilla.org/en-us/Firefox/addon/SearchReset/
And just in case you explore all categories on the page Add - ons - which you can access by using either:
- CTRL + SHIFT + a
- Firefox orange (or the Tools menu) button > Add ons
-don't forget to click Extensions in the left column to search for 'Community Toolbar' Add-ons that are usually created by Conduit.
Any improvement?
-
Impossible to search for songs on iPhone using iTunes search box
I have an iPhone running iOS 9.3 6, and my work PC was recently swapped for a newer model. The new PC running iTunes 12.3. Until the computer has been swapped, to search for a song on all my iPhone, that I had to connect my iPhone to the computer, click on "Music" in the column of playlist on the left side to see all the songs on my iPhone and type the name of a song (or any other relevant information) in the search box. Now, when I type the name of a song I want on my phone, I get a message "No results of library." In order to search for a song on my iPhone, I have to click the icon of the device (iPhone) on iTunes, scroll down to the "On My Device" section, click music and then type in my search term in the search box.
Any ideas how I can just return to search on the old way instead of having to do additional steps?
Click on the magnifying glass in the search box, and uncheck the box search entire library.
TT2
-
Months of searching for numbers on the sheet
Hello all and thanks in advance.
I have tabs at the top. DATA (sheet 1), JAN (sheet 2), FEB (record 3), etc. until the end of the year.
Data sheet will be the months on the left now I want care to go to the form to correct month and takes the total of the column relative to the other leaves and place in the correct cell line. (I've been copy paste, but I know there is an easier way to do this, so I turn to the people who know the numbers unlike my lack of knowledge.)
On the leaves of the month, I would also like to highlight the line that are sat and Sun.
Thanks again everyone for their help.
Rich
Hi, NN,.
You will have a Table for each month. Each Table must have a different name. Your summary table lists more than 12 months, then I would say the table name from each month is named with the name of the month AND the year.
The monthly tables may appear on separate sheets, or the same sheet. The key, as far as the formulae are concerned, is that each Table can be identified by its name.
The following example includes only the table for April 2016, named "APR 2016", I assumed that the total line will be row 33 on each table of data collection, but wrote the formula to allow the placement of the line totals in other places. The lines for most of the actual days have been hidden and has not been designated, as these labels have no role in the operation of the formula.
The TOTALS is defined as a footer line. The formula, in the columns showing a value is SUM (a) where 'a' is the letter of the column to be added. (The two values of zero have been entered manually for example).
The table has a unique formula, entered in cell B3 and filled with right and until the last line for which there is a Table whose name corresponds to the label in column A. For example, the formula has been met only 3 online.
B3: = INDEX (APRIL 2016: $A$ 1: $ 33, MATCH $N ("TOTALS", APRIL 2016: $A, 0), GAME ($ 1 B, APRIL 2016: $1: $1.0),)
Syntax:
INSTRUCTION (range,-l'index of the line, column-index, index of the surface)
range: all of the cells in the source table
the index of the line: the number of the start line to get the value. This is provided by the first statement of the GAME.
the index of the column: the number of the column from which to get the value. This is provided by the second statement to MATCH.
the index of the surface: omis. By default, 1. There is only 1 area of application of this INDEX, all of the source table.
MATCH (image search-search for, - where - method)
EQUIV function returns the position in the list of the search for value.
First case:
search for: TOTALS text
search - where: column A of table source
method): 0 means finding the exact value.
Second case:
search for: the text contained in the cell of line 1 of the specified column. That form is completed on the right, the increments of the column by one for each stage.
search - where: line 1 of table source
method): 0 means finding the exact value.
The formula should be changed for each new line. Three references to "APR 2016" should be changed to match the name of the table to collect this row grand totals. Once edited in column A, the formula can be filled right and automatically adapts to his new position.
Note: The duration value in column F of the table of the month wouldn't transfer and keep the same formula in column C of the summary table. Any attempt to restore the format to match your example resulted in a triangle of error.
Kind regards
Barry
-
Search for files based on the flow
Hi, I would like to be able to search for specific files mp3 and m4a files based on their bitrate, IE search for files with a bitrate to 128KBit.
I don't know, but is it possible under Windows Vista, or do I need another tool to do?
Thank you
Hello trotskyicepick,
Windows Search does not include a searchable property for the bitrate, but Windows Explorer can indicate the rate on view Mp3 files. For example, you can sort and filter the search results by bit rate and group your files in this way.
For example, if the files in question are in your folder of music and its subfolders, click music in the left pane of Windows Explorer. Now paste this query into the search engine:
ext:MP3
Now, right-click on a column heading in the right pane and add the property of spleen in the view. Click the bitrate column header to sort the display rate. Now click the drop down menu on the same header and choose "near CD quality' in the list. This filter the search results so that only files recorded to 128 or more appear.
Unfortunately, the Vista does not support the M4a format, so speeds of transmission of these files are not visible in Windows Explorer.
Mr. Doug in New Jersey
-
When you try to import a .mp4 file in windows movie maker, the program does not list the file when I search for it in his file. Help, please.
As I suggested previously, conversion to a format like
. WMV before you import it into Movie maker may be the solution.The free Converter from Microsoft can be a place to start:
(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)Download Microsoft Expression Encoder 4 with Service Pack 1 (SP1) (freeware)
http://www.Microsoft.com/download/en/details.aspx?displaylang=en&ID=24601
(runs under WinXP SP3 / Vista / 7)When you install the program...
Start Microsoft Expression Encoder 4
(Start / programs / Microsoft Expression /)
Microsoft Expression Encoder 4)On the "Load a new project" screen...
Left click... "Transcoding project '...When the program opens, click on... File / import...
(If at any time you get lost while browsing
the program of... to... Window / active Reset
Type or workspace... CTRL + SHIFT + R)Look for the file/s that you want to convert.
(If files do not appear... open the fall
window and choose... All files)Click (highlight) left the files and the left on the Open button.
You can see the files in the "Multimedia content" pane
In the right column... left click on the tab "Output"...
Open the drop directory window and choose an output folder.
(This is where you will find your converted file)On the left, click on the button "encode".
Wait... video encoding CPU intensive and can
be a slow process. It is always best if you do not have
multi-task while files are encoded.Now... try import you again. File WMV in Movie Maker.
More converters:
There are to many converters available on the net...
the following links are some examples. You can
need to experiment to find the best result.Proceed at your own risk *.
(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)(1) format Factory (freeware)
http://www.videohelp.com/tools/Format_Factory
(the 'direct link' is faster)
(the file you want to download is: > FFSetup270.zip<>
(FWIW... installation..., you can uncheck
'all' boxes on the last screen... even in this case, it may
install the Ask toolbar on your system)
(Windows XP / Vista / 7)First, you will need to decompress the file or just open the
Drag FFSetup270.exe out of the folder
and drop it on your desktop. To install left click.(2) Freemake Free Video Converter (freeware)
http://www.Freemake.com/free_video_converter/
(Windows XP / Vista / 7)(3) Koyotesoft Free Video Converter
http://www.koyotesoft.com/indexEn.html
(2000/XP/2003/Vista/Seven)(4) Sothink Free Video Converter
http://www.Sothinkmedia.com/video-converter/
(Windows XP / Vista / 7)(5) hamster Free Video Converter
http://www.PCWorld.com/downloads/file/FID, order 155794, 4 pages, 1/download.html
(Windows XP, Vista, 7)
(If you choose Custom Installation
You can uncheck additional modules you
do not want to install)(6) quick Media Converter
http://www.Cocoonsoftware.com/
(Win XP, Vista, Win 7 Home Premium)(7) SUPER © Simplified Universal Player Encoder & Renderer
http://www.videohelp.com/tools/Super
(the download mirror site is faster) (Windows XP / Vista / 7)(8) Xilisoft Video Converter
http://www.Xilisoft.com/video-converter.html
(not freeware but receives good reviews)
(Windows XP (SP2 or later) / Vista / 7)Good luck...
-
When searching for files in Windows Explorer (WIN 7), can the railways under folder reading "c:\help\me\please" instead of "Please (c:\help\me)?
Thank you!
What you can do is to do a search, right-click on any column heading (for example name, folder, etc.), and then click "Folder path" from the list that appears. You can also click to turn off the folder. The next time you're looking for in this area, this column of path of the folder should appear. You can drag the columns in a different order also.
-
Help? A matter of search for Windows 7...
I need to do a search for - only - hidden files or folders. I know I can put Explorer "Show hidden files and folders", but it shows - all files, not just those with the hidden attribute. I don't want to go through every file on my machine to pick them up.
Any help would be appreciated, thanks :)
We cannot directly use Windows 7 search to generate a list of items with a specified attribute. We can however in the command prompt. Or, a third option is to use another software of research that is out there that allows searching by attribute.
If using Windows 7 search, search using other properties you want, and then set the results window to display the named attributes column. (You can specify the columns of information appear - just right-click on any column title to display a menu, then click more... for a list.) Move the pointer of the mouse on the title attributes column and button click the arrow that appears to the right of the title. Click to put check marks in the boxes to the left of the desired attributes and combinations of attributes in the list of choices that appears.
Alternatively, with search for Windows 7, you can search with the attributes property, but oddly only by a numeric code that represents the sum of all the attributes of a file could have. Looking for attributes: 2 will give you all the files that have the hidden only attribute and no other attributes, but because the files can have several attributes, there are numerous possible different amounts you would search too so it isn't practical.
With a command prompt window, you can navigate the directory (folder or disk) that you want to search in (if you are familiar with the tricks of MS-DOS) and enter:
dir / a: h/s/b > results.txt
to create a file named results.txt in the current directory. Leave aside the/s if you do not want the included subdirectories in the search. Leave aside the/b (naked format) If you want to see the date, time, size and the information summarized for each file.
Other software from research that can search by specified attribute includes:
Maybe you are looking for
-
In the account settings my date of birth is incorrect (year) - I tried several times to fix it, but it keeps forcing me to reset my security instead of just answering q. No 'Save' button then tried just 'enter' or 'done'... once more, I get looped ba
-
C50-A-1JU satellite - cannot download drivers for Win7
Hello, I upgraded the operating system to Windows 7I couldn't find the proper driversDrivers on your site broken a download linkImpossible to download drivershttp://www.Toshiba.co.il/innovation/download_drivers_bios.jsp?LNG=29&service=IL
-
HelloI just downloaded and installed Photoshop cc 2015.5 via creative cloud to adobe:the trial has apparently expires after 7 days rather that the 30 advertised on the Web site.How many days should I really?Best
-
FMW: Links Portal Upgrade Advisor to the page build Middleware of Oracle 11 g Architecture
Perhaps a link in the Advisor to each document for installation/upgrade is needed. Would be very useful. And, if the document refernence is not specific to the step, but it is more general in nature, then a shor comment indicating to view only the
-
4.2 DOC BUG: BRANCH_TO_PAGE_ACCEPT undocumented
Use of BRANCH_TO_PAGE_ACCEPT as the value of the REQUEST is not documented. This is a significant omission for a very useful feature.