Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify tablespace_name in SQLPlus Oracle select

My setup looks like this

SQL> SELECT tablespace_name, table_name
     FROM all_tables
     WHERE tablespace_name = 'MYSPACE';

TABLESPACE_NAME            TABLE_NAME
-------------------------- ------------------------------
MYSPACE                    MYTABLENAME
MYSPACE                    MYOTHERTABLENAME

Now I'd like to SELECT * FROM MYSPACE.MYTABLENAME; but that's apparently not how you do it.

ERROR at line 1:
ORA-00942: table or view does not exist

My expected result would be to get all records from that table. Like I would if it was MySQL.

Thanks

like image 921
MyGGaN Avatar asked Oct 20 '25 05:10

MyGGaN


1 Answers

You are selecting from tablespace, which is not the same as your Owner/Schema name. Thats why. For example the tablespace SYSTEM has owner SYS. You do select from Sys.xxx;

Ok.

SELECT owner, tablespace_name, table_name
FROM all_tables
WHERE tablespace_name = 'MYSPACE';

And then

select * from [ owner ].[ table_name ];

(worth to mention: select .. from dba_tables / user_tables)

like image 122
MrSimpleMind Avatar answered Oct 22 '25 04:10

MrSimpleMind



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!