Home » SQL & PL/SQL » SQL & PL/SQL » getting error in UNIX
getting error in UNIX [message #298435] Wed, 06 February 2008 02:01 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Hi All,
I have two table as follows.
table_name=PORD1
item      units
1234        1
1234        10
2345        1
3245        1
3245        6

table_name=PROD2
item      desc
1234      chairs
1234      chairs
2345      books
3245      pens
3245      pens

Now required O/P is:
Item      decsrip
1234       1234 chairs_1
1234       1234 chairs_10
2345       2345 books_1
3245       3245 pens_1
3245       pens_6

I wrote a query in TOAD as follows
select p1.item,SUBSTR(p1.item, 1, 7)||' '||SUBSTR(p2.ITEM_DESC,1,52)||'_'|| p1.units  DESCRIP 
from prod1 p1,prod2 p2 
where p1.item=p2.item

I got O/P as per requirement.

same thing when I am running the script in UNIX I am getting the O/P as follows.
Item    Descrip
1234    1234 chairs_1
1234    1234 chairs_1
2345    2345 books_1
3245    3245 pens_1
3245    3245 pens_1

I am not getting the O/P as per requirement. I am getting the O/P in TOAD. Why I am not getting the O/P in UNIX.Please help me in this issue.
Please give me the solution for this.

Thank you.

[Updated on: Wed, 06 February 2008 02:11]

Report message to a moderator

Re: getting error in UNIX [message #298442 is a reply to message #298435] Wed, 06 February 2008 02:10 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Why I am not getting the O/P in UNIX

I can understand that as Unix does not talk SQL.
Do you mean SQL*Plus?

Copy and paste you "Unix" execution.
Keep your lines in 80 character width.

Regards
Michel
Re: getting error in UNIX [message #298444 is a reply to message #298442] Wed, 06 February 2008 02:13 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Hi Michel,

I have created the script with the same query with extention ".KSh" and execute the script. But I am not getting the required O/P.Can you please look into this.

I am getting the O/P as follows from UNIX.

1234 1234 BATTERIES_1
1234 1234 BATTERIES_1
Thank you.

[Updated on: Wed, 06 February 2008 02:16]

Report message to a moderator

Re: getting error in UNIX [message #298450 is a reply to message #298444] Wed, 06 February 2008 02:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post your script and post its execution.

Regards
Michel
Re: getting error in UNIX [message #298453 is a reply to message #298450] Wed, 06 February 2008 02:30 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

<FLOW name = "${PROGRAM_NAME}.flw">
${DBREAD}
<PROPERTY name = "query">
SELECT p1.ITEM,
SUBSTR(p1.item, 1, 7)||' '||SUBSTR(p2.DESC,1,52)||'_'|| p1.units DESCRIP
from PROD1 p1,PROD2 p2
where p1.item=p2.item
</PROPERTY>

This is the script I have...
Thank you
Re: getting error in UNIX [message #298454 is a reply to message #298453] Wed, 06 February 2008 02:32 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
That is not a Unix script. What is is? How is it executed? Post the actual execution like Michel already asked two times.
Re: getting error in UNIX [message #298455 is a reply to message #298454] Wed, 06 February 2008 02:35 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

This is XML script which was written in VI EDITOR . with name
"item.ksh"
I am running this one only.

Thank u.
Re: getting error in UNIX [message #298459 is a reply to message #298455] Wed, 06 February 2008 02:45 Go to previous message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
What you tell us you do does definetely not work :

$ cat item.ksh
<FLOW name = "${PROGRAM_NAME}.flw">
${DBREAD}
<PROPERTY name = "query">
SELECT p1.ITEM,
SUBSTR(p1.item, 1, 7)||' '||SUBSTR(p2.DESC,1,52)||'_'|| p1.units DESCRIP
from PROD1 p1,PROD2 p2
where p1.item=p2.item
</PROPERTY>
$ ./item.ksh
./item.ksh: line 1: syntax error near unexpected token `newline'
./item.ksh: line 1: `<FLOW name = "${PROGRAM_NAME}.flw">'
$


So you either tell us the truth about what you are doing, and post the actual execution or you are on your own.
Previous Topic: Problem in concectnation?
Next Topic: I need to sort out age from a list.
Goto Forum:
  


Current Time: Sun Dec 04 17:06:24 CST 2016

Total time taken to generate the page: 0.07166 seconds