d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Oracle 11g Is Pissing Me Off Y'all. > Table Name Length Truncated.
123Next
Add Reply New Topic New Poll
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 06:19pm
Code

REP_ID LAST FIRST C
---------- --------------- ---------- -
300 Abbot Greg N


This is what is displayed when I tried to view a row. The last column is supposed to display COMM for commission but truncates the fucking name every time. If I have more columns it won't display them too. I've set linesize 1000; etc. Though I did edit the properties menu when opening SQL Plus. Perhaps that is causing my issue? I've allows the default window size to be expanded larger. It allows me to type longer strings into Oracle but I does not display larger table lengths.

Anyone know what I can do to make SQL Plus display full length of table names before wrapping the text around again or truncating it?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 2 2014 06:30pm
http://www.sql-workbench.net/

that's a JDBC-based IDE. i doubt you can use packages/snippets and whatnot, but it works great for DML, table browsing, etc

is your problem only for select * or every select statement? i only use sqlplus for compiling packages, i dont use it for general use.

there's also TOAD and SQL Developer.

This post was edited by carteblanche on Mar 2 2014 06:43pm
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 06:48pm
I'm taking a class in Oracle SQL so I have been using SQL Plus for all of the assignments.

It's any select statement to be honest. It seems to cut off and/or wrap around after a certain number of characters. Rather annoying and aggravating. (Just like this class.)
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 2 2014 06:50pm
Quote (NinjaSushi2 @ Mar 2 2014 07:48pm)
I'm taking a class in Oracle SQL so I have been using SQL Plus for all of the assignments.

It's any select statement to be honest. It seems to cut off and/or wrap around after a certain number of characters. Rather annoying and aggravating. (Just like this class.)


are those assignments specific to sql plus or not? eg: click this button, then this button, then take a screenshot.

if it's not, use the link i posted. you can do all your dml there.
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 07:09pm
I was about to write out a fuck load of shit when I realized my problem. My COMM column is set to a CHAR(1) which obviously limits it to 1 character. Well how do I force it to display the entire columns title while still limiting it to 1 char? I forgot.

Edit: Derp. Column alias I believe..

So can I set a default column alias so each time a query that table it will automatically display the alias?

This post was edited by NinjaSushi2 on Mar 2 2014 07:16pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 2 2014 07:13pm
Quote (NinjaSushi2 @ Mar 2 2014 08:09pm)
I was about to write out a fuck load of shit when I realized my problem. My COMM column is set to a CHAR(1) which obviously limits it to 1 character. Well how do I force it to display the entire columns title while still limiting it to 1 char? I forgot.


1) why aren't you using varchar2(1)? char(1) is ok, but you should almost never use it for more than length 1. it's best to stay away from it altogether.
2) that has nothing to do with the length of the title. 1 char is for the rows, not the header.

Quote
Edit: Derp. Column alias I believe..


why dont you post your full sql?

This post was edited by carteblanche on Mar 2 2014 07:13pm
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 07:18pm
Quote (carteblanche @ 2 Mar 2014 20:13)
1) why aren't you using varchar2(1)? char(1) is ok, but you should almost never use it for more than length 1. it's best to stay away from it altogether.
2) that has nothing to do with the length of the title. 1 char is for the rows, not the header.



why dont you post your full sql?


I would like this:

Code
SQL> select * from store_reps
2;

REP_ID LAST FIRST C BASE_SALERY
---------- --------------- ---------- - -----------
101 Jailer Frank Y 30000
102 Mayflower April N 54000


to display like this:

Code
SQL> select * from store_reps
2;

REP_ID LAST FIRST COMM BASE_SALERY
---------- --------------- ---------- ---- -----------
101 Jailer Frank Y 30000
102 Mayflower April N 54000


I think it should make more sense if I phrase it like that. :P It was rather confusing eh?

This post was edited by NinjaSushi2 on Mar 2 2014 07:19pm
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 08:11pm
Quote (carteblanche @ 2 Mar 2014 20:13)
1) why aren't you using varchar2(1)? char(1) is ok, but you should almost never use it for more than length 1. it's best to stay away from it altogether.
2) that has nothing to do with the length of the title. 1 char is for the rows, not the header.



why dont you post your full sql?


I'm using CHAR(1) because the value will always be 1 in length. COMM defaults to Y but can also be N.

Code
ALTER TABLE store_reps ADD CONSTRAINT store_reps_comm_ck
CHECK (comm IN ('Y', 'N'));
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 2 2014 08:30pm
Quote (NinjaSushi2 @ Mar 2 2014 09:11pm)
I'm using CHAR(1) because the value will always be 1 in length. COMM defaults to Y but can also be N.

Code
ALTER TABLE store_reps ADD CONSTRAINT store_reps_comm_ck
CHECK (comm IN ('Y', 'N'));


i wasnt referring to the length of 1. i was referring to your datatype. why are you using CHAR instead of VARCHAR2? for length 1 it doesnt really matter, but for any other length it matters and VARCHAR2 is preferred. so it's best to get in the habit.
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Mar 2 2014 09:52pm
Quote (carteblanche @ 2 Mar 2014 21:30)
i wasnt referring to the length of 1. i was referring to your datatype. why are you using CHAR instead of VARCHAR2? for length 1 it doesnt really matter, but for any other length it matters and VARCHAR2 is preferred. so it's best to get in the habit.


I know. CHAR is preferred for character lengths up to four that are also constant. VARCHAR and VARCHAR2 are for characters that vary is size though I only use VARCHAR2 and never varchar because it's worthless old ass scripting. Frankly I fucking SQL or at least this fucking oracle class and am only doing it because that's the way the assignment is written.


Right now I am fucking furious because I can't figure out this stupid question and my book doesn't help. This fucking book worthless too. Maybe you can help before I put my fist through my computer monitors.

Quote
7. Change the constraint created in Assignment #6 so that associated rows of the BOOK_STORES table are deleted automatically if a row in the STORE_REPS table is deleted.


The rows referenced are rep_ID. Currently table book_stores column rep_ID is the foreign key of table store_reps column rep_ID. I don't fucking get what they are asking without dropping the constraint completely and I am going crazy berserk pissed at this bullshit. I fucking hate class dude. (never taking an online class again too.)
Go Back To Programming & Development Topic List
123Next
Add Reply New Topic New Poll