0

I have just created a new database and I'm at the stage now where I am looking to input my data. I've created the tables and the constraints work fine, and I have inserted 1 row successfully. However when running the query select * from mytable; it returns the table once for every field.

I have spent the past 2 hours researching why but cant find anything. Can anyone help please?

Thanks in advance.

8
  • 1
    What do u mean by "it returns the table once for every field" ? Commented Jan 6, 2015 at 11:19
  • Basically i have created a table with 10 column headers. I have then created a script to insert data. When i view my table it returns the table 10 times, rather than once with all the data in. Commented Jan 6, 2015 at 11:22
  • post sample insert scripts Commented Jan 6, 2015 at 11:27
  • What tool are you using to query the database? Is it SQL*Plus? Commented Jan 6, 2015 at 11:28
  • insert into gh_CUSTOMER(cust_firstName,cust_surname,Cust_house,Cust_addr1,Cust_addr2,Cust_town,Cust_city,Cust_pc,Cust_phone,Cust_fax,Cust_email,Cust_creditlimit,Cust_optout,Cust_notes,cust_id) values('Gavin','Howard',1,'1 Brown crescent','Eighton Banks','Gateshead','Newcastle','NE97EX','01914602096','01914602091','[email protected]',1,'y','no notes',1); Commented Jan 6, 2015 at 11:33

1 Answer 1

2

I assume that you're using SQL*Plus and that the columns in your table are rather wide (say varchar2(1000) for example).

In this scenario, SQL*Plus's width is to small to horizontally display multiple columns, hence it displays them vertically.

You could get around this with

select
  substr(col1, 1, 20) col1_,
  substr(col2, 1, 20) col2_
  ...
from
  table;

or, when still in SQL*Plus, with a column format command:

column format col1 a20
column format col2 a20
...
select * from table;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.