SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot LSW's Avatar
    Join Date
    Jul 2004
    Location
    Juneau Alaska
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there still an AND Keyword in PL/SQL?

    I am having to learn PL/SQL on the job and a simple comparisson is kicking my butt.

    Basically I want:

    FROM member.member
    INNER JOIN member.employment
    ON member.member.SSN = member.employment.SSN

    WHERE member.member.SSN
    AND member.employment.SSN
    LIKE SSN_MISC_WORKING.ssn

    This is after an INNER JOIN on the two tables SSN.

    I keep getting this error on the AND, error: ORA-00920: invalid relational operator

    I have done some searching and such and have found no AND keyword mentioned in any examples. Any one have an idea and can tell me what it is I am missing? I am using TOAD on Oracle and have some experience with SQL and none with PL/SQL.

    Thanks
    Thank You, Migwetth, Gunalche’esh, Ha’w'aa, Danke

    Kyle Lamson



  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    That's because there's no comparison operator being done on before you apply the AND. Since the member.ssn equals the employment ssn (hence the inner join), you can just use

    FROM member.member m
    INNER JOIN member.employment e ON m.ssn = e.ssn
    WHERE m.ssn LIKE SSN_MISC_WORKING.SSN

    note: the like syntax doesn't seem right - why not just use m.ssn = SSN_MISC_WORKING.ssn? Using the LIKE without '%' surrounding will compare a whole value - and slower than when you use equals since it will compare it byte by byte vs the whole field value.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  3. #3
    SitePoint Zealot LSW's Avatar
    Join Date
    Jul 2004
    Location
    Juneau Alaska
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, OK, I see what I did wrong. Most appreciated David.

    I did use "=" originally, but I have a habit of choosing the wrong ones. By the time I decided to ask here I was trying the LIKE. Switched back to "=" as you suggested.

    Cheers
    Thank You, Migwetth, Gunalche’esh, Ha’w'aa, Danke

    Kyle Lamson




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •