VARCHAR variable in where clause

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Jenny

    VARCHAR variable in where clause

    Hi NG

    How do I have to use a VARCHAR2 variable in a where clause.
    I could not find an example.

    PART_NR VARCHAR2(20);
    myPartId NUMBER()20;

    PART_NR := '101 189';
    select part_id into myPartId from part where part_nr = PART_NR; -- not working, hwo to do ?

    How do I have to "escape" the PART_NR, that it will be:

    where part_nr = '101 189'

    Thanks
    Peter

  • Peter Jenny

    #2
    Antw: VARCHAR variable in where clause

    Hi NG

    I just found the problem.

    PART_NR is the same as part_nr of course.

    so renaming PART_NR into PART_NR_TO_SEAR CH_FOR is solving the problem...

    Peter
    >>Peter Jenny<Peter.Jen ny@cedes.com20. 11.2003 15:31:29 >>>
    Hi NG

    How do I have to use a VARCHAR2 variable in a where clause.
    I could not find an example.

    PART_NR VARCHAR2(20);
    myPartId NUMBER()20;

    PART_NR := '101 189';
    select part_id into myPartId from part where part_nr = PART_NR; -- not working, hwo to do ?

    How do I have to "escape" the PART_NR, that it will be:

    where part_nr = '101 189'

    Thanks
    Peter

    Comment

    • Ed prochak

      #3
      Re: VARCHAR variable in where clause

      "Peter Jenny" <Peter.Jenny@ce des.comwrote in message news:<bpijac$4c c$1@rex.ip-plus.net>...
      Hi NG
      >
      How do I have to use a VARCHAR2 variable in a where clause.
      I could not find an example.
      >
      PART NR VARCHAR2(20);
      myPartId NUMBER()20;
      >
      PART NR := '101 189';
      select part id into myPartId from part where part nr = PART NR; -- not
      working, hwo to do ?
      >
      How do I have to "escape" the PART NR, that it will be:
      >
      where part nr = '101 189'
      >
      Thanks
      Peter
      >
      --
      What makes you think that
      PART NR
      is a valid variable name?

      (HINT: try PART_NR)

      Comment

      Working...