4 Replies - 1982 Views - Last Post: 09 August 2012 - 07:47 AM

#1 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

hi.. oracle programming

Posted 08 August 2012 - 04:47 PM

hi.. im a newbie here.. please help me how to code this one using pl/sql oracle.. thanks..

 select 'My name is ' || ename, 'and I am a ' || job from emp; 


i have to get the output like this:

My name is BLAKE and i am a MANAGER
My name is CLARK and i am a MANAGER
My name is SCOTT and i am an ANALYST
My name is KING and i am a PRESIDENT
My name is TURNER and i am a SALESMAN
My name is ADAMS and i am a CLERK
My name is JAMES and i am a CLERK
My name is FORD and i am an ANALYST

thanks.. :)

Is This A Good Question/Topic? 0
  • +

Replies To: hi.. oracle programming

#2 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

Re: hi.. oracle programming

Posted 08 August 2012 - 06:22 PM

hi.. so far, this is my code for the output;

 select 'My name is a ' || ename, 'and I am a ' || job from emp
  where JOB <> 'ANALYST'
  or 'My name is a' || ename 'and I am an ' || job
  where JOB = 'ANALYST';


but then i still have errors like this..


or 'My name is a' || ename 'and I am an ' || job
*
ERROR at line 3:
ORA-00920: invalid relational operator

please help me for further changes, so i can execute my codes.. thanks..

by the way, i am using oracle 11g..

good day!
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10397
  • View blog
  • Posts: 38,479
  • Joined: 27-December 08

Re: hi.. oracle programming

Posted 08 August 2012 - 06:33 PM

Moved to Oracle.
Was This Post Helpful? 0
  • +
  • -

#4 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

Re: hi.. oracle programming

Posted 08 August 2012 - 07:30 PM

sir, what are the difference of oracle 11g and oracle? thanks..

anyways, i got the.. :)
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5780
  • View blog
  • Posts: 12,596
  • Joined: 16-October 07

Re: hi.. oracle programming

Posted 09 August 2012 - 07:47 AM

'My name is a ' || ename, 'and I am a ' ||



See the comma? That will work for the select, but will give you another column. Try:
'My name is a ' || ename || 'and I am a ' ||




In this:
'My name is a' || ename 'and I am an '



You have nothing joining ename to anything, so it's simply wrong.

You "or" is kind of meaningless. All conditional expressions must resolve to true or false.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1