Problem with like operator

Hi all
We use as operator for the search feature (oracle 10G).
could someone help me in managing null, when we use as operator.

Ex:
Select empno, ename, d.deptno
from emp e, Dept. d
where e.deptno = d.deptno
and e.ename like '% JO %';

We have a text box to the end before you enter the name of the employee (ename) or part of ename. When the user does not use this option, he leaves it empty.

so in the query above, if ename is null then alors my query fails.

could someone help me handle this scenario.
My query should still give me all employee IDS, if the ename is empty.

using the dynamic sql is not advisable.

Thank you
Manju

Something like this->

satyaki>select *
  2     from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

Elapsed: 00:00:00.26
satyaki>
satyaki>
satyaki>select *
  2  from emp
  3  where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename));
Enter value for str:
old   3: where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename))
new   3: where upper(ename) like nvl('%'||upper('')||'%',upper(ename))

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
      7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       7000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20

13 rows selected.

Elapsed: 00:00:00.02
satyaki>
satyaki>/
Enter value for str: sa
old   3: where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename))
new   3: where upper(ename) like nvl('%'||upper('sa')||'%',upper(ename))

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10

Elapsed: 00:00:00.08

Kind regards.

LOULOU.

Tags: Database

Similar Questions

  • Wiped a computer due to problems with the operating system, but do not have any media to reinstall. Help.

    No operating system

    Hello

    I bought a second hand computer and there is no backup of the operating system CD. He had problems with the operating system start so I wiped it, but now I have to re - install.

    Would it not possible to obtain another copy of the operating system for that computer?

    All the best

    Dean

    Hello

    These are forums for Vista, so vista information is provided

    Here are the different ways to reinstall Vista

    Contact the manufacturer of the laptop computer and ask them to send you to vista recovery disks to reinstall the operating system back as it was when you bought it

    they do it for a nominal cost of $

    ____________________________________________________________

    also ask them if you have a recovery partition on your hard drive to get back to the way you bought

    you would normally press F8, F9, F10 or F11 or Alt + F10 or 0 to start to start the recovery process according to the manufacturer

    Ask them of the exact key sequence

    __________________________________________________________

    or borrow a vista microsoft dvd; not a HP, Acer recovery disk etc

    Make sure that you borrow the correct 32-bit or 64-bit microsoft dvd to your computer

    they contain all versions of vista

    This is the product key that determines which version of vista is installed

    http://www.theeldergeek.com/Vista/vista_clean_installation.html

    ____________________________________________________________

    How to replace Microsoft software or hardware, order service packs and replace product manuals

    http://support.Microsoft.com/kb/326246

  • Software for printing device Kodak esp7250 does not load as areas appear gray and Kodak said that it is a problem with the operating system 7

    I have problems trying to reinstall my printer software Kodak esp 7250.  The area where you register the software is empty and the Browse button to choose a place is gray, so it will not go any further because if you then choose then says invalid path.  Of course, it's an invalid path because it will not choose an or allow me to choose one.  I contacted Kodak and after working with it for a while, they said it's a problem with the operating system.  I have Windows 7 on a laptop Gateway.  I need my printer and get very frustrated because nobody seems to know how to solve this problem.  I was able to use it when I got to the laptop, but suddenly one day it wouldn't work.  Help, please.

    Hello

    Thank you for your response.

    Make the SFC scan and check the status of the issue.

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    I would also advise you to check the status of the issue in a new user account.

    Create a user account:
    http://Windows.Microsoft.com/en-us/Windows7/create-a-user-account

    If it works in a new user account, then you will need to fix the corrupted user profile. You can visit this link for the steps:
    http://Windows.Microsoft.com/en-us/Windows7/fix-a-corrupted-user-profile

    I hope this helps!

  • PROBLEM WITH MY OPERATING SYSTEM AND LAPTOP COMPUTER PART 3

    Hi all

    I speak not of what I already writtent here on my computer issues have, if you feel lost just report to my previous post below. Thank you all for your help. The following messages appear on the screen of my laptop:

    'msnmsgr.exe file corrupted the file C:\Users\MYNAME\AppData\Local\Temp directory is corrupted and unreadable. Please run the ChKdsk utility "

    "Skype.exe file corrupted the file C:\Users\MYNAME\AppData\Local\Temp directory is corrupted and unreadable. Please run the ChKdsk utility "

    "OSA.exe file corrupted the file C:\Users\MYNAME\AppData\Local\Temp directory is corrupted and unreadable. Please run the ChKdsk utility "

    At some point of time, I got the following message "cannot install required Windows files make sure all files required for installation are available, and restart the installation of the error Code: 0 x 80070571" after trying to reinstall Vista.

    Today, I tried to install WinCleaner OneClick to solve problems has my laptop, but I got this message: Setup could not create the directory "C:\Users\MYNAME~I\AppData\Local\Temp\is-B29TV.tmp error 1392: the file or directory is corrupted and unreadable".

    Setup could not create the directory "C:\Users\MYNAME~I\AppData\Local\Temp\is-AO2P4.tmp error 1392: the file or directory is corrupted and unreadable".

    Setup could not create the directory "C:\Users\MYNAME~I\AppData\Local\Temp\is-819TT.tmp error 1392: the file or directory is corrupted and unreadable".

    Setup could not create the directory "C:\Users\MYNAME~I\AppData\Local\Temp\is-UARNT.tmp error 1392: the file or directory is corrupted and unreadable".

    Setup could not create the directory "C:\Users\MYNAME~I\AppData\Local\Temp\is-J8ISF.tmp error 1392: the file or directory is corrupted and unreadable".

    When I open the device under Network Manager maps I saw a yellow triangle with an exclamation mark in front of Microsoft ISATAP #2 with a message "the device status this device does not work properly because Windows cannot load the drivers required for this device (code 31)"

    Below, you will find all the information you need to help me solve these problems with my laptop, because I do not have how to keep a current thread. Once again, thank you for your help

    FIRST POST OF THIS THREAD

    Greetings to one and all and I thank very you much for your help to help me.

    I have a laptop Dell Inspiron 1501 with Windows Vista Home Basic AMD Mobile Sempron processor. Recently, I tried to upgrade the free version of my Antivir Avira antivirus for a trial version, but during the process, I lost my internet connection. Sometimes, my network shows another "Local and Internet" and "Local" only. However, in both cases I am not able to connect to the Internet. Whenever I try to open a page in the browser, it is blank and nothing appears on the screen... I also try to reinstall the operating system, but since I can't access the Internet when I reached the point of the process called "GET IMPORTANT updates to UPDATE for the INSTALLATION" where I have to choose between two options a) go online to get the latest updates (recommended) and b) do not get the latest updates for facilities , I can only opt for the other that says that the installation may fail. Therefore, it seems that I cannot even reinstall the operating system. In addition, I often small windows to appear on my screen as "msnmsgr.exe" "skype.exe" "OSA.exe" file corrupted with such messages "the file C:\Users\ myname\AppData\Local\Temp directory is corrupted and unreadable. Please run the chkdsk utility ". However, the problem is I can't run the check disk, because every time I have it try I got the following message "checking file system on C, the type of files is NTFS one of your disks needs to be checked for consistency. You can cancel the disk check, but it is strongly recommended that you continue"until I read the whole message again appears" the disk check was cancelled ". I am not able to get the help and Support Windows open, but on the window I only heard the message "you have lost your connection using Windows and support". I don't know what to get my computer works well and my connection internet back. Someone here tell me step by step what to do to solve all the problems mentioned above? I am very grateful to each of you. Please, note that from my computer I have not access to Internet, so tell me any solution which will take me to use my computer to connect to the Internet. Sorry for the length of my post.

    PS at the beginning of this problem I used to have errors with their code on the screen of my laptop, but unfortunately I did not take account of their > more, for to appear the problem worsens my computer was a bit slow

    SECOND POST OF THIS THREAD

    First of all, thanks a lot to you all and especially to the Lorien-SpiritX and their insightful answers. As they both suggest to me I tried sfc/scannow and I received the following message on my laptop screen "start the phase of checking system scan audit 44% complete Windows resource protection could not perform the requested operation"

    I did also check CHKDSK/f/r utility Office and I received the following message "the type of the file system is NTFS cannot lock drive current CHKDSK cannot run because the volume is in use by another process. You want to schedule this volume to check the next time the system restarts "and I answered Yes

    In addition, I tried to use my CD to reinstall my operating, but if it starts well by copying files to the end of the process, when the second stage of the process "expand our files" starts, it stops at 27% and never goes further.

    These are all questions, added to all that I already mentioned in my first post with the same title

    This looks like failing hardware, not software. I would look at the hard drive first, and then the RAM and the motherboard.

    http://www.elephantboycomputers.com/page2.html#Hardware_Tshoot

    If the computer is still under warranty, contact Dell technical support.

    On tests of hardware failures often alleged swapping parts by parts checked. If you can not do the test yourself and/or are uncomfortable opening your computer, take the machine to a professional computer repair shop (not your local equivalent of BigComputerStore/GeekSquad). If possible, have all your data backed up before taking the machine into a shop.

    MS - MVP - Elephant Boy computers - don't panic!

  • problem with the operating system 64-bit client

    Hi, I'm having a problem installing of operating, including windows server 2008 R2 64-bit 64-bit, but even other OS gives the same error

    I tried with vmware workstation 6.5.1 and 7.1.0 from the VW console and check utility also said, that the host is NOT capable of running a 64-bit under this product vmware host.

    My guest operating system is windows XP Professional SP3 32-bit

    the processor is an Intel Core 2 E8400 3 GHz and the support for virtualization is enabled in the bios I looked into it and ran the securable application, he said: "Hardware Virtualization locked IT.

    What could be the problem?

    The VT in the bios was already activated, in any case I turned off the PC too.

    I checked today with the Intel Processor Identification Utility and it says for Intel virtualization technology: No. cannot know what is missing.

    This looks like a buggy BIOS. What system using (name of seller/model). Looking for an update of the firmware on the suppliers Web site.

    André

  • Problem with LIKE when you use NLS_COMP = LINGUISTIC and NLS_SORT = BINARY_AI

    Oracle Version: 11.2.0.1.0

    My goal is to try to make all the connections of the case. I put in my SPFILE NLS_COMP = "LINGUISTIC" and NLS_SORT = "BINARY_AI."

    Whenever I use a LIKE comparison without beginning wildcard character (%), it does not return the correct results.
    The following is a generic example. My problem is clearly with query #3. Someone at - he lived this before?

    CREATE TABLE People (
      ID NUMBER(1,0),
      FirstName NVARCHAR2(20),
      LastName NVARCHAR2(20));
    INSERT INTO People (ID, FirstName, LastName) VALUES ('1', 'John', 'Doe');
    INSERT INTO People (ID, FirstName, LastName) VALUES ('2', 'Jane', 'Doe');
    INSERT INTO People (ID, FirstName, LastName) VALUES ('3', 'Rich', 'Donner');
    INSERT INTO People (ID, FirstName, LastName) VALUES ('4', 'Mike', 'Redoer');
    -- Query #1
    SELECT ID FROM People WHERE Lastname = 'doe';
    
    -- Results (Correct)
    -- 1
    -- 2
    -- Query #2
    SELECT ID FROM People WHERE Lastname LIKE '%doe%';
    
    -- Results (Correct)
    -- 1
    -- 2
    -- 4
    -- Query #3
    SELECT ID FROM People WHERE Lastname LIKE 'do%';
    
    -- Results (Incorrect)
    -- 1
    -- 2
    -- 3
    -- 4

    This seems to be a BUG.
    This one is somewhat similar.
    [url https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=PATCH&id=9149540.8] Bug 9149540 - bad results for the operator LIKE with NLS_SORT = binary_ci and NLS_COMP = linguistic ID 9149540.8
    Have you created a SR?

  • Satellite A100 - problem with the operation of the battery

    Hello!

    My laptop (I bought 1.5 years ago) has a big problem when you use with the battery.
    First of all, with a fully charged battery, the notification of "limited battery status" appears after 2 minutes of operation and after 5 minutes, he goes to the standby mode due to the level of the battery is very low.

    Then, I plug it into the AC power and the battery remains yellow for about 15 minutes light and then turns blue.
    (The battery is OK, I tested it on another satellite A100)

    What can be the problem?

    Thanks in advance!

    Maria

    Given that you have tested the battery in another satellite A100, the problem must be in the settings of your computer:

    1 > START > CONTROL PANEL > POWER SELECT THE OPTIONS ICON

    2 > you will now see a screen that shows your management food and note * one * has a tick that is a small point in a circle:

    3 > BALANCED > POWER SAVER > HIGH PERFORMANCE

    4 > THE PLAN OF POWER > CLICK ON CHANGE PLAN SETTINGS > WILL DISPLAY A SCREEN SHOWING YOUR PLAN!

    5 > GO TO > * CLICK * WHERE IT SAYS CHANGE ADVANCED POWER SETTINGS

    6 > IF YOU SCROLL THE BAR TO THE * SIGN + > BATTERY-CLICK * THE * SIGN.

    7 > YOU SHOULD HAVE: you will need to have play with these settings, or you can click on restore plan defaults to see if that will solve your problem

    Notes by clicking on the * + plus SIGN next to tany of these options below will allow you to change what event happens on your computer.

    + CRITICAL BATTERY ACTION

    + LOW BATTERY LEVEL

    + CRITICAL BATTERY LEVEL

    + LOW BATTERY NOTIFICATION

    + BATTERY LOW ACTION

  • Problems with arithmetic operations

    I do mathematical operations on my tables to retrieve the average records.
    I have a table of insurance useda table of connected clients, and client.
    Now, I would like to extract the average number of incidents per year took place from the first strategy until today.

    If I run this query:

    SELECT (SUM (c.incFatti () + c.incSubiti ())) AS AVERAGE / * incFatti() is made by the customer, incSubiti() incidents suffered incidents * /.
    CLIENT c;

    I get 8, for example, I have a total of 8 incidents in my DB.
    Now, if I run it:

    SELECT ROUND (((SYSDATE - MIN (p.data_stipulazione)) / 365), 2)
    Polizza p;

    I receive 1.28, for example, a year and a few months since the creation of the first strategy until today.

    OK, 8 / 1.28 = 6.25 accidents per year and that's what I would get with a single query.
    The latter is:

    SELECT (ROUND)
    Sum (c.incFatti () + c.incSubiti ()) / / * the first query * /.
    (((SYSDATE - MIN (p.data_stipulazione)) / 365), 2) AS AVERAGE / * the second query * /.
    CLIENT c, polizza p

    But I get 31.26! When I make a mistake?

    Try

    select round (n1 / average, 2)
      from (select sum (c.incfatti () + c.incsubiti ()) n1 /* from the first query */
                                                          from cliente) c,
           ( (select ( (sysdate - min (p.data_stipulazione)) / 365) as average /* from the second query */
                                                                              from polizza))
    
  • problems with an operating system

    Theme font & size changer may work with firefox under windows, but it does not work with ubuntu. Not at all.

    so in ubuntu, you can change the font size for Application, Document, Desktop, fixed width and the window title. in your personal preferences.

    but no matter what, using firefox, or no, theme fonts content font size is 8 points.

    It is a known problem.

    Hello

    You can try to set a Minimum font size in Tools (Alt + T) > Preferences > content > Advanced (under fonts and colors).

    Options > content

    Tools > Options

  • problem with restart operating system upgrade

    I recently bought a refurbished mac model identifier: imac8, 1... I bought and installed snow leopard operating system and I am now trying to upgrade further, the problem I have is when I do an upgrade that the computer does not restart, it just goes to the star screen and do not turn off and restart it, how do I solve this?

    If the computer still has installed 10.6.3 according to your profile and then download and install Mac OS X 10.6.8 v1.1 updated Combo. Then, open the software update (System preferences - software update) and see if there are several updates to the system. If there is, install them all!

    If you want to install a newer version of Mac OS X, then you will need to make sure that the computer has 4 GB or more of RAM (your sleeps 6GB) and then navigate to the Mac App Store and install El Capitan 10.11.1

    If you continue to have problems, maybe a visit to the dealer that you buy is in order or you will need to find a CENTER in your area that can help. Apple stores won't work on a 2008, it is considered a legacy machine.

  • Fixed the pc and now problems with the operating system.

    So a few weeks ago I had replaced my motherboard fried and all the rest. Windows claimed to resurrect my computer, my copy of Windows 7 is not legitimate and does not accept my product key. Any advice on how to fix this?

    If your license of Windows 7 comes with the previous motherboard, it is not transferable to a new motherboard.

    If it is a license upgrade of retail that you bought in a store, the motherboard, you take a match it must have a previous qualification licence.

    You can also try the following:

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

  • Problems with the operation of the Second paper tray - HP Officejet Pro 8500 has more

    I just bought a second paper cartridge for my HP Officejet Pro 8500 has more. It shows up on my printer paper tray 2.  However, I can't understand how to go between the paper trays to get items to print from the individual trays.  A choice should not result when I click on PRINT?  Or if I should not be able to set up a default tray for printing on letter size, but be able to change in the other side, when I want to print an envelope?

    I will be happy to help you with this problem.

    The 2nd test is an accessory. It is not downloaded in the drivers. You will need to do the 2nd tray DEFAULT tray for stationery. Go to your settings on the printer. Choose Preferences and go to the default tray.

    The envelopes and any other type of paper in addition to the letter will be put in TRAY 1.

    Let me know how it goes.

  • Work with LIKE operator

    Hello

    I have a little confusion in the safeguard clause.

    create the products table (product_name varchar2 (100));

    Start

    insert into products (product_name) values('A%_WQ123');

    insert into products (product_name) values('A%BWQ123');

    insert into products (product_name) values('AB_WQ123');

    commit;

    end;
    /

    Select * from products where product_name like '\%_WQ12% %' escape '-';

    output:

    product_name

    ----------------

    A % _WQ123

    A % BWQ123

    can you please tell how it works, in the above statement the ESCAPE escape only % or the two and_ %

    Thank you

    Hopefully, this will clear your query!

    1.

    Select * from products where product_name as '% \%_WQ12%' escape '-';
    OP: -.
    A % _WQ123
    A % BWQ123

    Here, you are escaping only '%' no '_ '.   And '_' sets a single character ('B' and '_') before the expression 'WQ12% ' and after '%' (escaped).

    2.

    Select * from products where product_name as '% \%\_WQ12%' escape '-';

    OP-
    A % _WQ123

    Here, you are escaping both '%' and '_ '. It will review so these two characters as part of the expression '% WQ12 '. So like this template, there is only one record.

    Thank you!

  • Problem with between operator in the view criteria

    Hello

    We have a requirement. In the view criteria, we have a Timestamp attribute. We use between operator , so we have two variable bind fromDate and up to date . The search works fine if I give to plu date fromDate but if the same date for the bind variable, it does not return all records in the table .

    Any solution to overcome this peoblem?




    KR

    KR,

    So are the timestamps fromDate and up-to-date? Are they fair dates, then they will be interpreted as midnight as-des-than-present, and unless your timestamp is from midnight, it would not be between them more. You can also set - Djbo.debugoutput = console in the properties of your project to see the SQL query running in the log window.

    John

  • BlackBerry Smartphones anyone have problems with sections of your screen?

    Even if there are some problems with the operating system as has been noted by several previous discussions, I am satisfied my storm because of its hardware capabilities and am willing to be patient as RIM solves problems in software.  The problem I have is that the left side of the bottom of my screen does not feel the same clicking positive like the rest of the screen.  I spoke with someone at a local verizon store and they explained that it is common and that there nothing wrong with mine, or at least that there was no different than most.  I also checked the demos of two storms they had on display and both units seemed to have a defect similar to the screen.  Storm of my wife, however, is perfect, with the same positive feeling by clicking on parts of the screen.  I would not be concerned with it except that when I type in the lower-left corner of the screen I have errors or reduces typing speed because of the absence of "click".  Finally, my question is can I Exchange it for another and hope that the following better, or just simply keep in mine because it's like most of the units and get a perfect as my wife is the luck of the draw?  Thank you

    Your screen should click systematically everywhere like your wives Storm.  Basically, the problem with your phone by clicking on not everywhere is a tight screw or screws.  When you remove the cover of your battery, you will notice two torx screws.  We'll have a red and white sticker underneath the battery and the other on the opposite side will not.  If you have a torx T-6 screwdriver you can correct this problem by turning the screw or screw to the left to unscrew the screws.  You can try half of the towers at a time and test your screen to ensure uniformity to click after each turn to don't not to loosen the screws too.  Here is a link that has been posted on crackberry dot com that others have used this procedure to correct their screen by clicking on the problem: http://forums.crackberry.com/f86/screen-click-problem-fixed-using-different-method-109036/

    If your Storm is perfect except the screen click problem, I suggest trying the fix published previously.  If you feel uncomfortable, try this, I will ask a new device that clicks on evenly all over the way it should be.

Maybe you are looking for

  • I can not connect and I sent to reset and it has yet to come in my Inbox. I waited long

    I can't sign in with my password so I sent to reset. It has been all day and I didn't get the e-mail with instructions for password

  • Need drivers for Toshiba Portege 3500

    Hi I m new to the forum. I have the problem. I can't find t on Toshiba support drivers and utilities for this model, where can I find all this kind of software (console, saving etc..)?

  • No more noise after installing XP Home on Satellite Pro 4600

    Hi gentlemen, I have not all sounds more after that I installed winxp home on my Pro 4600. I used the problem solving Assistant but without any improvement. I also installed the latest audio driver and bios. Looking forward to some responses... Harry

  • ReadyBoost steal my drive!

    After using a SD card with readyboost, readyboost (.sfcache) cache file is still present on the drive. Now the whole SD have become write-protected, and I can't seem to remove the cache file. And can't OPEN the file cache to boost my system again! I

  • no computer or boot

    I recently added more than 4,000 songs to my itunes library and then accidentally added shortcuts on my desktop for the work of those 4000 songs, while trying to remove the shortcuts, I deleted my desktop completely and the only thing on my screen is