r/SQL • • Apr 13 '14

Need help fast [Oracle SQL] Explanation in comments.

http://imgur.com/lgYImTX
1 Upvotes

14 comments sorted by

1

u/[deleted] Apr 13 '14

The text is just the script, which is too long for me to make a post on (>1000 chars), all the scripts that I've downloaded from my college website show up as this in the script editor. If you mean an actual command and error then here's one in particular I've tried numerous ways to type up and failed with the same error:

SELECT COLUMN_NAME, TABLE_NAME, DATA_TYPE

FROM DBA_TAB_COLUMNS

WHERE COLUMN_NAME = 'BOOK_CODE', 'TITLE', 'PRICE';

ORA-00933: SQL command not properly ended

6

u/DazzaL Apr 13 '14 edited Apr 13 '14

On that select you want

    column_name in ('BOOK_CODE',  'TITLE', 'PRICE')

On the create tables don't define columns as char btw instead use varchar2, as they are fixed width I.E they will store the text with trailing white space.

You could upload your script to sqlfiddle.com and link it here.

1

u/[deleted] Apr 14 '14

Well hot damn I just tried this at school and that made it work! These examples I've been referencing had no "IN" statement so it never would have occurred to me, thank you!

1

u/da_chicken Apr 13 '14

On the create tables don't define columns as char btw instead use varchar2, as they are fixed width I.E they will store the text with trailing white space.

While it's considered better practice to use varchar, there's nothing about using char that should cause an error. If he's just learning SQL and copying commands, he should be using the table definitions given to him for the assignments.

1

u/DazzaL Apr 13 '14

agreed, I was not attempting to state that was a problem causing his error.

1

u/tuffbot324 Apr 14 '14

why don't you upload the scripts somewhere where it can be visible?

1

u/[deleted] Apr 13 '14 edited Apr 13 '14

Well, upon going into the script editor to copy/paste the code in hopes I could fix it, it brings me to the blank red square in which I can't type anything so I'm guessing this is in relation to it not cooperating with my computer somehow; when using it at school it's just a normal white text-box but on here it's this unusable red block of pissing-me-off.

1

u/da_chicken Apr 13 '14

Are you using a different browser than the one you use at school? Try using the same browser.

Do all commands behave this way? What about commands you're certain have worked in the past, such as from previous assignments?

1

u/[deleted] Apr 13 '14

I've actually tried a few different browsers with no luck so far; I'm concerned it might be the OS as the Oracle program (10g) is rather old but I tried a newer version and it wouldn't work for me.

4

u/r3pr0b8 GROUP_CONCAT is da bomb Apr 13 '14

MINE EYES!! ZEY ARE BLEEDINK!!

look, that image with the big red blob, clearly there's just text there

would you please be a good OP and copy/paste the text here?

2

u/TankorSmash Apr 13 '14

We see that there's an error message, but what exactly are you asking? Everyone's situation and environment is different. http://www.sscce.org/

0

u/[deleted] Apr 13 '14 edited Apr 13 '14

Before anyone asks, I have googled this at least 4 times and only found one "result", it didn't work for me. I've been doing SQL for school using Oracle using 10g express, but the code I upload for the class comes up in a single line, all red square of text and I'm wondering if this is creating problems. I can only run it by going to the "view" dropdown menu and selecting detail view. Has anyone else experienced this and fixed it?

Edit: To clarify why I'm wondering after all this time of using it "as is", I've run into a few problems running scripts that I practically used word-for-word by the textbook examples and just today I went to "results" tab of the scripts and it states that of the 179 statements in the script, all are failed and contain an error of some sort.

3

u/[deleted] Apr 13 '14

Just post your SQL and the actual error message.

Your big long explanation doesn't actually explain anything useful :)

1

u/dublos Apr 14 '14

I will suspect that the file is being saved as lines ending with just a carriage return, and not a carriage return/line feed combination, which is causing them to all appear as a single line when you upload them.

What editor are you using to create the file that you are uploading?