How to use the case to replace the & in the select statement

Oracle version: 11.1.0.6.0
RHEL

Hello

I want to get a list of all users that are expired and locked, but want to replace '&' with and here is my code but it does not work.
Please some advice, thanks.

SQL > select username,.
2 cases (account_status as 'EXP %' then "A UP AND LOCKED"
3 ELS 'no locked user '.
4 end) account_status
5 of dba_users
6 where account_status as "EXPI % ';
case (account_status as 'EXP %' then "A UP AND LOCKED"
*
ERROR on line 2:
ORA-00907: lack of right parenthesis

Hello
Can u try like this

Select the username, account_status,
cases where account_status like 'EXP %' then 'A EXPIRED AND LOCKED'
End ELSE Account_status "account_status.
from dba_users
where account_status as "EXP % ';

concerning
srikkanth. M

Tags: Database

Similar Questions

  • How to use the select statement in loop for

    Hi all

    My question is can I use a select statement in for loop like as follows.

    for the key in the selection of one_table key.

    When I use this am getting an error as found select invalid I ID

    How to select a statement use in loop for

    Please suggest me.

    Thank you
    Sree

    Hello

    You can use code below

    For key in (select button from table_a)
    loop
    If key.key = 1 then
    -insert statement
    on the other
    -Select statement
    end loop;

    Thank you
    Naveen.

  • How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    Ashley,

    What about window > show the rectangle enclosing (Ctrl / Cmd + Shift + B to toggle)?

  • How to pass parameter in the function using the select statement?

    Hello

    I had a problem. I can't pass as parameter to the function by using the select statement. But it can pass as a parameter using the "code". How can I solve this problem?

    For example,.
    Select * from table (SplitFunction ('HS750020, HS750021')) < < < this work.

    but

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) < < < do not work.

    Thank you for trying to help him. Thank you.

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36'))< do="" not="">

    Try like this

    select * from table(select splitfunction(lot_no) from tracer_search_schedule where job_id='36')
    

    Just make sure that your subquery returns only 1 row.

  • In version 5, how to use the selection tool to move items?

    I can use the selection tool to select objects, but when I try to drag, nothing happens. My solution is to use the selection tool to select an object, then use the transform tool to drag the object in its new position. Any help is greatly appreciated.

    Start by restoring your InDesign preferences. Tutorial here:

    http://PFL.com/TRB

  • How to display the data type long using the select statement

    Hai All

    I have to select the text of a view. But the text is declared as long and I need to see full view

    When I use this

    Select the text in all_views where view_name = "DAILY_ATTEND_VIEW";

    I have got only half of a select statement

    Concerning

    Srikkanth.M

    Hello

    SQL> SET LONG 100000
    SQL> select text from user_views
      2   where view_name='MVIEW';
    
    TEXT
    ------------------------------------------
    select e.empno,e.deptno,d.dname
    from emp@sdblink e,dept@sdblink d
    where e.deptno=d.deptno
    

    But it is limited to sql alone. If you use the double click TOAD on the text column in the grid will show you the entire SQL views.
    Unfortunately, there is limitation to consider,
    The largest value that you return from the function would be 32 k (RETURN VARCHAR2), both.

    Twinkle

  • [JS CS5] How to get the selected state of a multi-state object

    Does anyone know if there is a way to identify the State of a multi-state object is selected?

    You can select different States of an object of several State in the States Panel.

    In the object model.

    Mon_etat = app.selection [0].states.item (0);

    myState.active = true;

    .. .all the first State to the DSO. But I can't understand how to identify the State in which is currently visible. This doesn't seem to be possible in the object model, unless I'm missing something. Any ideas?

    Hey!

    Take a look at 'activeStateIndex' of MSO.

    Hope that helps.

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Update using the Select statement

    I have a requirement of the main table was updated. Here is an example
    Example (a) works in PL SQL but does not work in Forms6i.
    Example (b) works in PLSQL so in Forms 6i.

    I need work example (a) in forms 6i. What is the solution


    one)
    UPDATE fman_validation_master SET TOT_HRS = TOT_HRS +.
    (SELECT SUM (FAV. H TOT_HRS)
    OF FMAN_ACTQTY_VALIDATION FAV
    WHERE fman_validation_master. = PROJECT: CONTROL. PROJECT AND
    fman_validation_master. PROJECT = fav. PROJECT AND
    fman_validation_master. ACTIVITY_CODE = FAV. ACTIVITY_CODE
    FAV GROUP. PROJECT, FAV. ACTIVITY_CODE
    ) where of the = project: CONTROL. PROJECT;


    (b)
    UPDATE fman_validation_master SET TOT_HRS =
    (SELECT SUM (FAV. H TOT_HRS)
    OF FMAN_ACTQTY_VALIDATION FAV
    WHERE fman_validation_master. = PROJECT: CONTROL. PROJECT AND
    fman_validation_master. PROJECT = fav. PROJECT AND
    fman_validation_master. ACTIVITY_CODE = FAV. ACTIVITY_CODE
    FAV GROUP. PROJECT, FAV. ACTIVITY_CODE
    ) where of the = project: CONTROL. PROJECT;

    Hello

    According to Oracle 8.1, you can say:

    UPDATE  table_x
    SET     column_a = exp;
    

    where exp is any expression, or

    UPDATE  table_x
    SET     column_a = (ssq);
    

    where ssq is now called a scalar subquery. Oracle 8.1 sometimes allowed scalar subqueries in places where the documentation did not say that they were allowed. The first statement is an example, when you use

    tot_hrs + (ssq)
    

    as an expression. It works in SQL * Plus and also in PL/SQL, but (apparently) not in the forms.

    Re-write your UPDATE statement so that the scalar subquery appears in itself to the right of the sign =, like this:

    UPDATE     fman_validation_master
    SET     tot_hrs =
         (
         SELECT     fman_validation_master.tot_hrs + SUM (fav.tot_hrs)
         FROM     fman_actqty_validation     fav
         WHERE     fman_validation_master.project          = fav.project
           AND     fman_validation_master.activity_code     = fav.activity_code
         )
    WHERE     project = :control.project;
    

    In other words, just move the original fman_validation_master.tot_hrs (to which you add the SUM) of the main request in the subquery.

  • Insert a variable + string using the select statement with cfquery

    I'm doing an insertion by a select statement where the insert for one of the fields should be a combination of a vaule comes from the selection and concatenated with a string of text. Is this possible and if what the correct syntax so? Here is an example of what I'm trying, but does not.

    < name cfquery = "createnote" datasource = "#application.datasource #" >
    INSERT INTO gtbl_notes (notedate, strCustomerID, notetype, note, notecreatedby)
    SELECT "#currentdate #", strCustomerID, "miscellaneous", "#gtbl_people.email # DELETED because of HARD BOUNCE ', 'Bounce Routine.
    OF gtbl_people, gtbl_bounces
    WHERE gtbl_bounces.email = gtbl_people.email AND gtbl_bounces.subscriber = 1 AND gtbl_bounces.status = 2

    < / cfquery >

    Any input would be greatly appreciated.

    Concatonation is possible with most, if not all of the databases.  The syntax is a specific software and you do not your specify.

  • How to use the United States-International keyboard in Windows 8

    Hello

    I can't find a way to US International keyboard configuration in Windows 8. It's really frustrating because I like working with an English keyboard, but I often have to write Spanish accents or special characters.
    Best regards, Miguel.

    Hello

    Took me a little while to understand it as it is not obviously accessible somehow...
    Please, try the following. Go to 'Control Panel\Clock, language and Region\Language', click English (United States)... 'options', then 'Add an input method', search for [QWERTY] United States International Touch Keyboard layout (in my case) or similar; then 'Add '.
    Once he shows up the international sort, DELETE the default English input method.
    You should then be able to n, a e i o u without delay by pressing first the focus then the letter
    Then hold down the Ctrl and Alt keys +! do
    Then hold down the Ctrl and Alt keys +? do
    I hope this helps.
    Pablo
  • Creating a table using the Select statement of the physical layer

    Hello

    I use 10G, and I have the sub query in my physical layer. I chose the type of Table as Select and gave the SQL below. When I say the number of lines of update updates lines 93, that is correct, but does not show me the columns, or when I say display data, it does not show me the data, please see if I'm doing something worng. Thanks for your time and your help.

    Select (select program_id, project, actvty_id, commitment_date, row_number() over (partition by order project by commitment_date desc) as rnk project, actvty_id, program_id, commitment_date)
    of project_detail) a
    where rnk = 1

    Yes, create columns individually and click view data, you'll be able to get data

  • JCheckBoxMenuItem with Action aid - how to get the selected state

    Hello

    I have a JMenu with some JCheckBoxMenuItems. I want to use with an Action. Is it possible to get the status of the Action CheckBoxMenuItem selection?

    Thanks in advance
    Dominik

    Swing only updates the Action.SELECTED_KEY property if it has been set, so when you create your action you must set this value.

    myAction.putValue(Action.SELECTED_KEY, false);
    
  • Need to know how long takes the Select statement of the cursor?

    Hi people
    I want to know the duration of execution of the cursor in a stored procedure.

    Piece of my code is provided below.

    procedure Process_PCN_MAT_Custs)
    p_PCN_OID in varchar2,
    p_days_back number
    ) is
    number of vcount;
    v_newoid varchar2 (16);
    date of pcn_create_date;
    T_DATE: = to_char (sysdate, ' dd/mm/yyyy hh24:mi:ss');
    cursor (SAP_Customers)
    x_PCN_OID varchar2,
    number of x_days_back
    date of x_pcn_create_date
    ) is
    Select
    KUNNR,
    Max (soldflag) soldflag,
    Max (shipflag) shipflag,
    Max (endflag) endflag,
    Max (custName) custname
    de)
    Select / * + DRIVING_SITE (bims_pcn_shipments) * /.
    KUNNR,
    SoldFlag,
    ShipFlag,
    EndFlag,
    custName
    Of
    bims_pcn_shipments_mview

    where
    material_number in (select sap_material_no from the pcn.material where pcn_oid = x_PCN_OID)
    and bdr_date > (x_pcn_create_date - x_days_back)

    UNION
    Select / * + DRIVING_SITE (bims_pcn_shipments) * /.
    KUNNR,
    SoldFlag,
    ShipFlag,
    EndFlag,
    custName
    Of
    bims_pcn_backlog_mview

    where
    material_number in (select sap_material_no from the pcn.material where pcn_oid = x_PCN_OID)
    and bdr_date > (x_pcn_create_date - x_days_back)

    )
    Group
    KUNNR;
    dbms_output.put_line to_char (v_date);

    Begin
    Open SAP_CUSTOMERS
    ---
    ---
    ---
    close SAP_CUSTOMERS
    end

    I get an error of compilation for this line [T_DATE: = to_char (sysdate, ' dd/mm/yyyy hh24:mi:ss');].
    Saying "+ Error (95,12): PLS-00103: encountered the symbol"="when expected as follows: constant exception < an ID > < a double quote delimited identifier > table Fedya double Ref char time timestamp interval date binary character national nchar"< an ID >"symbol has been replaced for"="continue +.»

    I would be grateful if someone can help me solve this weired compilation error.

    Thank you
    Vineet

    Then you need to go to the function [DBMS_UTILITY. GET_TIME. http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_util.htm#sthref7809].

    Something like that...

    n := dbms_utility.get_time;
    
    dbms_output.put_line( (dbms_utility.get_time-n)/100) || ' seconds....' );
    

    Published by: Karthick_Arp on January 16, 2009 05:07

  • How to write the SELECT statement

    Commission of the CARDS
    0-20 0
    21-25 500
    26-31 650
    32-36 850
    37 > 1050


    If a PERSON sells 28 cards in one month, commission would be calculated as below.

    25 * 500 = 12500
    3 * 650 = 1950

    Total commission 14450

    I guess that's what you're looking for...

    CREATE TABLE WG (A NUMBER);

    INSERT GT VALUES (0);

    INSERT GT VALUES (28);

    SELECT * FROM GT

    0
    28

    SELECT THE CHECK BOX
    WHEN IS > = 0 AND<=20 then="">
    WHEN WAS > = 21 AND HAS<=25 then="">
    WHEN WAS > = 26 AND HAS<=31 then="">
    WHEN WAS > = 32 AND HAS<=36 then="">
    WHEN > = 37 THEN 36 * 850 + (A-36) * 1050
    ON THE OTHER
    NULL VALUE
    END TEST
    THE GT;

    Output:

    0
    14450

    Thank you...

  • After replacing the motherboard of PC how can use the license package, is the same hard drive.

    Mr President, our pc is repaired & change the motherboard and now how to use the product under license of photoshop

    It could be cleaner if you uninstall the products in question, using the CS cleanup tool and then contact Adobe technical support via chat and ask to reset your activations before install and activate the software again.

    Adobe Creative Suite cleanup tool

    helps resolve installation for CS3 thru CS6 and creative cloud problems

    http://www.Adobe.com/support/contact/cscleanertool.html

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat

    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

    Before you uninstall, you can see if you can extract the serial number in case you don't have it at hand.

    If it's a Windows machine, and then try running Belarc Advisor

    http://www.Belarc.com/free_download.html

    For a Mac, you can try:

    https://Mac-product-key-Finder.com/

  • using the function - how to use the values of the input variables on the table select statement names

    Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.

    CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    )

    RETURNS INTEGER

    AS

    -Declaring variables

    v_is_true INTEGER.

    BEGIN

    SELECT

    CASE

    WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)

    THEN 1

    ON THE OTHER

    0

    END

    IN

    v_is_true

    Of

    in_schema.in_tablename

    ;

    RETURN v_is_true;

    END;

    /

    When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist

    How to use the values of the input variables on the table select statement names?

    Hello

    Here's a way you can use dynamic SQL statements for this task:

    CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    in_first_date DATE DEFAULT SYSDATE - 1,.

    in_last_date DATE by DEFAULT NULL

    )

    RETURNS INTEGER

    AS

    -IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield

    -contains all the dates in the in_first_date of the range through included in_last_date

    - and it returns 0 if there is no such lines.

    -If in_last_date is omitted, the search only the data on in_first_date.

    -If in_first_date is omitted, it defaults to yesterday.

    -Time parts of the in_first_date and in_last_date are ignored.

    -Declaring variables

    sql_txt VARCHAR2 (1000);

    v_is_true INTEGER.

    BEGIN

    sql_txt: = 'SELECT COUNT (*).

    || 'FROM ' | in_schema | '.' || in_tablename

    || 'WHERE ' | in_datefield | ' > =: d1'

    || «AND» | in_datefield | '< >

    || 'AND ROWNUM = 1';

    dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE");  -For debugging

    Sql_txt EXECUTE IMMEDIATE

    IN v_is_true

    With the HELP of TRUNC (in_first_date) - d1

    TRUNC (NVL (in_last_date

    in_first_date

    )

    ) + 1                -- d2

    ;

    RETURN v_is_true;

    END is_ydaydata_to_table;

    /

    DISPLAY ERRORS

    If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above.  In this way, you can easily see exactly what will be executed.  Comment out the call to dbms_output under test is completed.

    Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future.  For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days.  The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).

Maybe you are looking for

  • Mac overheating using safari after upgrading to Sierra

    My Macbook 2012 mid pro 15-inch was overheating after using Sierra for 10 minutes. Watch safari activity monitor is the cause of this. I deleted the history, cookies and data from the Web site, even reinstalled Sierra, but seems does not work.

  • No Apple USB driver in Windows 10 Device Manager

    Is there a way to retrieve the Apple USB driver in Windows 10 Device Manager.  I downloaded the iTunes 12.3.3 yesterday and now he is gone. I tried plug into each of my Apple devices (iPod, iPad, iPhone, iPhone 4S 6) restarting my computer disabled m

  • Damaged printhead error!

    Replaced the black print cardtridge and now I get a damaged print head error.  No previous problems or errors with the OfficeJet 6500 Wireless printer.  Any ideas other than the replacement of the print head?

  • Create Bluetooth earpiece function only works in some cases

    The function create a listener Bluetooth generates an ID of listener that lets wait for an incoming connection of Bluetooth. Because every time that you run a VI that contains this function, it must create a new listener ID, otherwise the block follo

  • WHAT CARTRIDGE?

    I have a HP deskjet 2050 all in one printer. The provided cartridge was a 122 HP but when I check the HP site it says a HP61. What is the correct cartridge?