Expression   cannot be used as an INTO-target of a SESELECT/FETCH Statement

Hello guys
Iam new to oracle and this my first post
I have written this code in sql
declare
2 cursor madecursor is select bus_id ,bus_destination ,seat_no ,
3 driver_name from bus for update of seat_no nowait ; myseat bus.seat_no%type
4 ; begin
5 for bus_id in madecursor loop
6 select myseat into bus.bus_id from bus where
7 bus_id = bus_id
8 ; if
9 myseat < 5 then
10 update bus set seat_no = seat_no*2 WHERE CURRENT OF madecursor
11 ; DBMS_OUTPUT.PUT_LINE('Updated');
12 end if ;
13 end loop;
14 end;
but I have the following errors:-
ERROR at line 6:
ORA-06550: line 6, column 27:
PLS-00403: expression 'BUS.BUS_ID' cannot be used as an INTO-target of a SELECT/FETCH statement
ORA-06550: line 6, column 2:
PL/SQL: SQL Statement ignored
please help me.
Thanks in advance.
user613283

Firstly thank you for replies , I get use of your suggestions and change my code but still having errors please suggest.
SQL> declare
2 I_myseat bus.seat_no%type;
3 begin
4
5
6 select I_myseat into I_myseat from
7 bus where
8 bus_id = bus.bus_id
9 ;
10 if I_myseat < 5 then
11 update bus set seat_no = seat_no*2
12 where I_myseat<5
13 ; DBMS_OUTPUT.PUT_LINE('Updated');
14
15 end if;
16 end;
17 / declare
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 6

Similar Messages

  • PLS-00363: expression cannot be used as an assignment target

    Hi,
    Oralce9.2
    when I run the insert procedure I get the below error:
    Procedure
    PROCEDURE proc_one_insert(col1 IN OUT numeric,
    col2           IN num,
    col3     IN numeric
    BEGIN
    execute immediate proc_one_insert(2,1,111);
    END;
    Error
    PLS-00363: expression '2' cannot be used as an assignment target
    How to solve the above error ?
    With Regards
    Edited by: user640001 on Dec 2, 2010 3:04 AM

    Arun has shown you an example using PL/SQL. If you want to do something similar in other languages you have to use their style of variable declaration e.g. if you wanted to do it through SQL*Plus, you need to declare the variable within SQL*Plus itself and bind that into your calls e.g.
    SQL> create procedure p_inout (p_val in out number) is
      2  begin
      3    p_val := p_val*10;
      4  end;
      5  /
    Procedure created.
    SQL> var mynum number
    SQL> exec :mynum := 10;
    PL/SQL procedure successfully completed.
    SQL> print mynum
         MYNUM
            10
    SQL> exec p_inout(:mynum);
    PL/SQL procedure successfully completed.
    SQL> print mynum
         MYNUM
           100
    SQL>

  • PLS-00363: expression '' cannot be used as an assignment target - HELP :-(

    Hi Guys,
    This is a procedure I have in the body of a package:
    PROCEDURE SUM_EVENTS (p_trial_no IN NUMBER,
                                  p_country_resion IN VARCHAR2,
                                  p_loc_no IN NUMBER,
                                  p_setup_flag IN VARCHAR2,
                                  p_event_changed IN OUT NUMBER) ISWhen I call this in SQLplus with this:
    exec DB_CALC.sum_events(340,'USA',1,'Y',3700);I get this:
    ERROR at line 1:
    ORA-06550: line 1, column 54:
    PLS-00363: expression '3700' cannot be used as an assignment target
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignoredAny ideas what I'm doing wrong?
    Thanks!

    p_event_changed is declared as an IN OUT parameter. You need to provide a variable in which the OUT values can be written to..
    something like
    declare
    out_val number := 3700;
    begin
    DB_CALC.sum_events(340,'USA',1,'Y',out_val);
    end;

  • PLS-00363: expression 'I' cannot be used as an assignment target

    Hello all
    I have a Package and I have one procedure in it .
    I have use dmlset inside this .
    Inside that procedure I have a cursor and inside the FOR loop I have mentioned something .
    FOR i IN 1 .. No_of_rec LOOP
    If....
    End if ;
    i := i+1 ;
    END LOOP;
    I have mentioned before end loop i := i+1 ; when i execute this package it is showing this error .
    "PLS-00363: expression 'I' cannot be used as an assignment target"
    What could be the problem?

    Of course,
    My example is showing that index I in loop is same thing as parameter IN in procedure1. Its value, not reference. I is passed as VALUE to LOOP just like PARAM1 is passed as value to PROCEDURE1. Trying to assignment something to I or PARAM1 will generate same error.
    Also another interesting example is
    CREATE OR REPLACE
    PROCEDURE procedure1(
        param1 IN OUT NUMBER)
    AS
    BEGIN
      param1 := 0;
    END procedure1;
    BEGIN
      FOR i IN 1..3
      LOOP
        procedure1(i);
      END LOOP;
    END;
    In this case procedure1 is correct but loop stmt is not. It will generate same error.
    After doing this examples i also concluded that procedure cant return value it can modify existing value of variable which is declared (uninitialized or initialized, OUT or IN OUT ) in upper PLSQL block (named or unnamed PLSQL block)

  • Error PLS 00363  expression "string" cannot be used as an assignment target in sentence SELF.ATTRIBUTE1:=PARAMETER;

    Hi everybody. I wrote de following  type
    create or replace TYPE ALMACEN AS OBJECT
      id_almacen number(10),
      descripcion varchar2(40),
      existencias number(6),
      precio number(4),
      member function movimiento (p_num number)  return boolean
    create or replace TYPE BODY ALMACEN AS
      member function movimiento (p_num number)  return boolean AS
      v_inf boolean;
      n number(6);
      BEGIN
        if self.existencias+p_num>=0 then
        self.existencias:=existencias+p_num;
        return TRUE;
        else return FALSE;
        end if;
      END movimiento;
    END;
    I have Oracle 11g release I.
    In previous releases it worked, but now SQLDeveloper marks
    self.existencias:=existencias+p_num;
    Error PLS 00363  expression "string" cannot be used as an assignment target in sentence
    Please, What's wrong?
    Thanking in advance

    Hi,
    Not quite a PL/SQL XML question but anyway...
    Since the member function modifies the object instance, the implicit argument "self" must be declared explicitly as "IN OUT" :
    member function movimiento (self in out nocopy almacen, p_num number)  return boolean

  • Why Scalar Subquery expression cannot be used in HAVING clauses?

    Hi All,
    I'm new to SQL. I'm confused with Scalar Subquery.
    Is there anyone who can answer me why Scalar Subquery expression cannot be used in HAVING clauses.
    Can you show me a example?
    Thanks very much,
    Xianyi.Ye
    Edited by: 908428 on 2012-1-16 下午7:24

    Hi,
    908428 wrote:
    Hi Frank,
    Thank you for your quick reply. I also agree with your point.
    But when I read the book, "OCA Oracle Database SQL Certified Expert Exam Guide",( link to illegal copies of book removed by moderator )
    on Page 359, it said that
    Scalar subquery expressions cannot be used in the following locations:
    1. In CHECK constraints
    2. In GROUP BY clauses
    3. In HAVING clauses
    4. In a function-based index (which is coming up in Chapter 11)
    5. As a DEFAULT value for a column
    6. In the RETURNING clause of any DML statement
    7. In the WHEN conditions of CASE
    8. In the START WITH and CONNECT BY clauses, which we discuss in
    Chapter 16.7 and 8 are wrong. Scalar sub-queries can be used in WHEN conditions and START WITH and CONNECT BY clauses. (At least in Oracle 10.2. Is the book based on some earlier version?)
    Edited by: BluShadow on 17-Jan-2012 09:08

  • I use my apple I'd to sign into iCloud and it says - unsupported apple I'd this apple I'd cannot be used to sign into iCloud? Please help

    I use my apple I'd to sign into iCloud and it says - unsupported apple I'd this apple I'd cannot be used to sign into iCloud? Please help

    Just login the https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/  and change your Apple Id's Password, and if you receive any such Emails in future do not provide your Personal Details and report the same to Apple Immediately.

  • Objects containing objects.Expr cannot be used as an assignment.PLS-00363.

    Hi,
    My database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0.
    I'm working with Object types containing other object types, and I'm getting the error PLS-00363 (Expression cannot be used as an assignment).
    I'm putting exlpicity all 'SELF' parameters as 'IN OUT', but still get the error...
    CREATE OR REPLACE TYPE TYP_PERSON AS OBJECT (
    strName VARCHAR2(100),
    --+
    CONSTRUCTOR FUNCTION TYP_PERSON RETURN SELF AS RESULT,
    --+
    MEMBER      FUNCTION getName (SELF IN OUT TYP_PERSON) RETURN VARCHAR2,
    MEMBER     PROCEDURE setName (SELF IN OUT TYP_PERSON, pNewName VARCHAR2)
    +) NOT FINAL;+
    +/+
    --+
    CREATE OR REPLACE TYPE BODY TYP_PERSON AS
    --+
    CONSTRUCTOR FUNCTION TYP_PERSON RETURN SELF AS RESULT IS
    BEGIN
    SELF.strName := NULL;
    RETURN;
    END;
    --+
    MEMBER      FUNCTION getName (SELF IN OUT TYP_PERSON) RETURN VARCHAR2 IS
    BEGIN
    RETURN SELF.strName;
    END;
    --+
    MEMBER     PROCEDURE setName (SELF IN OUT TYP_PERSON, pNewName VARCHAR2) IS
    BEGIN
    SELF.strName := pNewName;
    END;
    END;
    +/+
    --+
    CREATE OR REPLACE TYPE TYP_PERSONS AS TABLE OF TYP_PERSON;
    --+
    CREATE OR REPLACE TYPE TYP_CREW AS OBJECT (
    strName VARCHAR2(100),
    persons TYP_PERSONS,
    --+
    CONSTRUCTOR FUNCTION TYP_CREW RETURN SELF AS RESULT,
    --+
    MEMBER      FUNCTION getName    (SELF IN OUT TYP_CREW) RETURN VARCHAR2,
    MEMBER     PROCEDURE setName    (SELF IN OUT TYP_CREW, pNewName VARCHAR2),
    --+
    MEMBER     PROCEDURE addPerson  (SELF IN OUT TYP_CREW, pPersonName IN VARCHAR2),
    MEMBER      FUNCTION getPerson  (SELF IN OUT TYP_CREW, pIndex IN NUMBER) RETURN TYP_PERSON,
    MEMBER      FUNCTION getPersons (SELF IN OUT TYP_CREW) RETURN TYP_PERSONS
    +) NOT FINAL;+
    +/+
    --+
    CREATE OR REPLACE TYPE BODY TYP_CREW AS
    --+
    CONSTRUCTOR FUNCTION TYP_CREW RETURN SELF AS RESULT IS
    BEGIN
    SELF.strName := NULL;
    SELF.persons := TYP_PERSONS();
    RETURN;
    END;
    --+
    MEMBER      FUNCTION getName (SELF IN OUT TYP_CREW) RETURN VARCHAR2 IS
    BEGIN
    RETURN SELF.strName;
    END;
    --+
    MEMBER     PROCEDURE setName (SELF IN OUT TYP_CREW, pNewName VARCHAR2) IS
    BEGIN
    SELF.strName := pNewName;
    END;
    MEMBER     PROCEDURE addPerson  (SELF IN OUT TYP_CREW, pPersonName IN VARCHAR2) IS
    BEGIN
    SELF.persons.EXTEND();
    SELF.persons(SELF.persons.LAST) := TYP_PERSON(pPersonName);
    END;
    MEMBER      FUNCTION getPerson  (SELF IN OUT TYP_CREW, pIndex IN NUMBER) RETURN TYP_PERSON IS
    BEGIN
    IF SELF.persons.COUNT > 0 THEN
    RETURN SELF.getPersons()(pIndex);
    END IF;
    RETURN NULL;
    END;
    MEMBER      FUNCTION getPersons (SELF IN OUT TYP_CREW) RETURN TYP_PERSONS IS
    BEGIN
    RETURN SELF.persons;
    END;
    END;
    +/+
    --+
    DECLARE
    crew_one    TYP_CREW;
    BEGIN
    crew_one    := TYP_CREW();
    crew_one.setName('The last crew on Earth');
    crew_one.addPerson ('Michael Knight');
    crew_one.addPerson ('Agent Mulder');
    crew_one.addPerson ('Agent Scully');
    crew_one.addPerson ('Frodo Bolson');
    for i in crew_one.persons.FIRST..crew_one.persons.LAST LOOP
    dbms_output.put_line('Person ['||i||']: '||crew_one.persons(i).getName());
    end loop;
    crew_one.getPerson(1).setName ('Michael Knight-----');
    crew_one.getPerson(2).setName ('Agent Mulder---');
    crew_one.getPerson(3).setName ('Agent Scully---');
    crew_one.getPerson(4).setName ('Frodo Bolson----');
    for i in crew_one.persons.FIRST..crew_one.persons.LAST LOOP
    dbms_output.put_line('Person ['||i||']: '||crew_one.persons(i).getName());
    end loop;
    END;
    How can I do this ParentObject().getChildObject().setChildFunction()?
    Thanks in advance,
    Donato.

    You completely misunderstand objects. Use:
    DECLARE
        crew_one TYP_CREW;
    BEGIN
        crew_one := TYP_CREW();
        crew_one.setName('The last crew on Earth');
        crew_one.addPerson ('Michael Knight');
        crew_one.addPerson ('Agent Mulder');
        crew_one.addPerson ('Agent Scully');
        crew_one.addPerson ('Frodo Bolson');
        for i in crew_one.persons.FIRST..crew_one.persons.LAST LOOP
          dbms_output.put_line('Person ['||i||']: '||crew_one.persons(i).getName());
        end loop;
        TYP_PERSON.setName (crew_one.persons(1),'Michael Knight-----');
        TYP_PERSON.setName (crew_one.persons(2),'Agent Mulder---');
        TYP_PERSON.setName (crew_one.persons(3),'Agent Scully---');
        TYP_PERSON.setName (crew_one.persons(4),'Frodo Bolson----');
        for i in crew_one.persons.FIRST..crew_one.persons.LAST LOOP
          dbms_output.put_line('Person ['||i||']: '||crew_one.persons(i).getName());
        end loop;
    END;
    Person [1]: Michael Knight
    Person [2]: Agent Mulder
    Person [3]: Agent Scully
    Person [4]: Frodo Bolson
    Person [1]: Michael Knight-----
    Person [2]: Agent Mulder---
    Person [3]: Agent Scully---
    Person [4]: Frodo Bolson----
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Aggregate functions cannot be used in group expressions

    Hi have report showing sales by Vendor. I need to list all the vendors with Monthly Total>5000 and combine the rest as "OTHER VENDORS"
    Vendor is a Group in my report, so I tried to put an expression as a Group on:
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    I've got an error: "aggregate functions cannot be used in group expressions"
    How do I get Vendors with Sales < 5000 into  "OTHER VENDORS" ?

    Hi,
    You need to group by Month on group expression,
    And you can use the same expression in the report column as 
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    Many Thanks
    ..................................................................................................................................................................Please
    mark the post as Please mark the post as answered if this post helps to solve the post.

  • HT4623 I just plugged my iPhone into my Mac. I had updated my phone system and lost all the info on my calendar. I was going to see if I had updated  in iTunes before I updated, but when I plug my iPhone in a pop up says "The iPhone cannot be used because

    I just plugged my iPhone into my Mac. I got this pop up - The iPhone cannot be used because it requires iTunes version 11.1 or later. Go to www.itunes.com to download the latest version of iTunes. I went to the address and updated my Mac but the pop up still comes up - I can't find out if they mean my iPhone needs to be updated or how to update it if that is the case.

    Hi RileyAvaCadenRiver,
    If you recently updated your iPhone to iOS7, you will need to update iTunes on your computer to iTunes 11.1 or newer for it to correctly recognize the iPhone. You may find the following link helpful:
    Apple: iTunes 11.1.1
    http://support.apple.com/kb/DL1614
    Regards,
    - Brenden

  • SSRS countrow Aggregate error(Aggregate and lookup functions cannot be used in query parameter expressions.)

    Below expression works fine with text box but gives error in dataset expression.
    ="SET FMTONLY OFF select  "+ join(Parameters!Column.Value,",") +" FROM pamcustom.dbo.vw_HFL_HFD_HotfileData INNER JOIN pamcustom.dbo.HFL_HFB_HotFileBatch  on BatchID = HFB_intBatchID where BatchID ="+Parameters!BatchId.Value+"
    and "+Parameters!cmbTranType.Value+" "+ iif(CountRows("DS_Aml_Mnr_Iss_Desc")=Parameters!Mnr_Iss_Desc.count," "," and aml_mnr_iss_desc in "+"('" & join(Parameters!Mnr_Iss_Desc.Value,"','")
    & "')")+iif(CountRows("ds_ReportingCategory")=Parameters!ReportingCategory.count," "," and ReportingCategory in "+"('" & join(Parameters!ReportingCategory.Value,"','") & "')")+iif(CountRows("ds_NAICSubGroup")=Parameters!NAICSubGroup.count,"
    "," and naicsubgroup in "+"('" & join(Parameters!NAICSubGroup.Value,"','") & "')")+iif(CountRows("ds_PortTrading")=Parameters!PortTrading.count," "," and porttrading in "+"('"
    & join(Parameters!PortTrading.Value,"','") & "')")+iif(CountRows("ds_GL_LE")=Parameters!GL_LE.count," "," and gl_le in "+"('" & join(Parameters!GL_LE.Value,"','") &
    "')")+iif(CountRows("ds_coagroup")=Parameters!cmbCoaGrp.count," "," and coagroup in "+"('" & join(Parameters!cmbCoaGrp.Value,"','") & "')")+iif(CountRows("Portfolio")=Parameters!cmbPort.count,"
    "," and portfolio in "+"('" & join(Parameters!cmbPort.Value,"','") & "')")+IIf(IsNothing(Parameters!txtSecID.Value)," "," and secid in ('"+Replace(Parameters!txtSecID.Value,",","','")+"')")+iif(IsNothing(Parameters!minPortFilter.Value)
    and IsNothing(Parameters!MinPort.Value)," "," and portfolio "+Parameters!minPortFilter.Value+Parameters!MinPort.Value)+iif(IsNothing(Parameters!maxPortFilter.Value) and IsNothing(Parameters!MaxPort.Value)," ","
    and portfolio "+Parameters!maxPortFilter.Value+Parameters!MaxPort.Value)+iif(IsNothing(Parameters!minCoaFilter.Value) and IsNothing(Parameters!txtMinCoa.Value)," "," and portfolio "+Parameters!minCoaFilter.Value+Parameters!txtMinCoa.Value)+iif(IsNothing(Parameters!maxCoaFilter.Value)
    and IsNothing(Parameters!txtMaxCoa.Value)," "," and portfolio "+Parameters!maxCoaFilter.Value+Parameters!txtMaxCoa.Value)
    I guess the error " Aggregate and lookup functions cannot be used in query parameter expressions." is because I am using CountRow to ensure that if all values of multi select all selected i will not use that filter in where clause.
    Pls. guide...

    Hi, Include your parameter total count in the dataset for parameter and instead of using countrows() function use the count from dataset in the expression.
    Hope this helps.........
    Ione

  • I have movies in my movie library but i cannot play them or drag them into my ipod.There is an exclamation point next to each of them.Then when i click on it to play it it says the movie cannot be used because the original file could not be found.

    I have movies in my i tunes library but i canot play them or drag them into my i pod.There is an exclamation point each of them.Then when i click on them to play them on my pc it says this movie cannot be used because the original file could not be found.Help?

    Read threads list over on the right under the heading of More Like This
    Allan

  • When I plug my iPod touch into computer it says "this Ipod cannot be used because the Apple mobile device service has not started

    When I plug my iPod touch ino the computer it says "this ipod cannot be used because the Apple mobile device service has not been started. The screen shows to plug it into itunes and will not do anything.

    Have a look here:
    iPhone and iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • When i plug my itouch into my computeri get a pop-up that says "this ipod cannot be used because the apple mobile device service is not started." and when i plug it it my itouch name does not come up on my itunes, how do i start it and fix this?

    When I plug my iPod Touch 4g into my computer I get a pop-up that says "This iPod cannot be used because the Apple Mobile Device service is not started." And when I plug in my iTouch the name of the iTouch does not come up on my iTunes. How do I start the Apple Mobile Device? How do I fix this?

    I'd start with the following document with that one:
    iPhone, iPad, iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • When i plug my ipod touch 4g into my computer is says that "this ipod cannot be used because the apple mobile device service is not started"  what do i do?

    when i plug my ipod 4g into my computer is says that "this ipod cannot be used because the apple mobile device service is not started" what do i do?

    http://support.apple.com/kb/TS1567
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

Maybe you are looking for

  • How to restore a site deleted from SharePoint Designer 2010

    Hi All,      I have opened a test server site in share point designer 2010, & deleted that particular site in SP designer 2010,can anyone let me know how to restore the site by using SharePoint Designer? I followed below mentioned procedure to restor

  • Mic problem & warrenty issue .

    Hiii I have iPhone 4S which is having mic problem i guess.During voice calls the call receiver at other end unable to hear my voice on handset mode but on speaker mode he can hear my voice. Also wanted to know in which country my phones warrenty is v

  • Should Give Error Message

    Hi all Purchasing organization 001 assigned to company code 001, when user want to create Vendor with P.Org 001 and comapny code 002 the system should give error message During Vendor creation ,if the wrong purchase organisation is selected, system i

  • Email Notifications stop working on all of my forms.  Help?

    Email Notifications stop working on all of my forms.  Help?

  • Hosts - plea for help!

    HI, There are threads on this elsewhere, but I am still struggling to get my hosts file set up and ban some of the advertising pop ups on the internet I use textwrangler to edit my hosts file (in my etc folder) (usually have to authenticate myself).