On the grounds that Bush wouldn't know which way up to hold the manual?Quote:
Originally posted by Mr.Hanky
Kerry must have coded that SQL!!!
Printable View
On the grounds that Bush wouldn't know which way up to hold the manual?Quote:
Originally posted by Mr.Hanky
Kerry must have coded that SQL!!!
On the grounds that he couldn't spell SQLQuote:
Originally posted by DaPi
On the grounds that Bush wouldn't know which way up to hold the manual?
Anyway ... dumb SQL. I sent some code to a collegue and he wasn't sure if it was working.
However, he modified it so that it "did work". Here's a paraphrasing of the code that he says works ...
Can anyonme spot where he's going wrong? :rolleyes:Code:Select Max(col3)
From my_table1,
my_table2
Where 'MY_TABLE1.COL1' = 'MY_TABLE2.COL1'
And 'MY_TABLE1.COL2' = 'MY_TABLE2.COL2'
Which table does Max(col3) belong to? Unless it only exists in one of the tables it will cause an error. That's a very odd query though.
Actually, it's the way that the column names in the predicates are wrapped in single-quotes (thus turning them into string literals) that is the problem. Effectively he has written ...Quote:
Originally posted by gandolf989
Which table does Max(col3) belong to? Unless it only exists in one of the tables it will cause an error. That's a very odd query though.
Code:Select Max(col3)
From my_table1,
my_table2
Where 'A' = 'B'
And 'X' = 'Y'
Hmm ... and I assume the code have perfect indentation and neat and clean.Quote:
Originally posted by slimdave
Can anyonme spot where he's going wrong? :rolleyes:Code:Where 'MY_TABLE1.COL1' = 'MY_TABLE2.COL1'
And 'MY_TABLE1.COL2' = 'MY_TABLE2.COL2'
Here's what I saw ... I just replaced the table names and column names.
Perfect error trap !Code:SELECT emp_name
FROM emp
WHERE id = some_vbl
IF SQL%ROWCOUNT > 1 THEN
generate_some_error ... ;
END IF ;
Well it compiles doesn't it? :rolleyes: I should have seen that. :confused:Quote:
Originally posted by slimdave
Actually, it's the way that the column names in the predicates are wrapped in single-quotes (thus turning them into string literals) that is the problem. Effectively he has written ...
Code:Select Max(col3)
From my_table1,
my_table2
Where 'A' = 'B'
And 'X' = 'Y'
Here's the explanation from my collegue on his thought process ...
Verrrry encouraging.Quote:
I see, I get in a mode that simply says "what are the different ways this can be done" a-z than I start down the path trying things....
I see. I know this is bad. But what are the different ways of shooting ?
Perhaps he should move "read book about sql" to the top of his list of trying things. :rolleyes:Quote:
Originally posted by slimdave
Here's the explanation from my collegue on his thought process ...
Verrrry encouraging.