Right, so when I run:
Select * from Consultants
I get:
ORA-00942: table or view does not exist
The table clearly exists in the object browser.
However, when I run:
select * from Customers#xe.m512Finn
I get the data requested.
Please don't tell me that the table in the local database doesn't exist because it does; I created it and it's there in the object browser.
Is there something wrong with my syntax? Please help me with any suggestions.
Here you're selecting from the Consultants table
Select * from Consultants
And here you're selecting from the Customers table
select * from Customers#xe.m512Finn
The table does exists in m512Finn user that's why it returns the values for
select * from Customers#xe.m512Finn
You might be running that query in a different schema or the query u might be looking for must be
Select * from consultants#xe.m512Finn
Okay i've resolved the issue, it's that when you query local tables, you need double quotation marks around the table name.
select * from "Consultants"
Related
I need dynamically obtain table name from system table and perform a select query on this table example:
SELECT "schema"+'.'+"table" FROM SVV_TABLE_INFO WHERE "table" LIKE '%blabla%'
it returns my_schema.the_main_blabla_table
And after I get this table name I need to perform :
SELECT * FROM my_schema.the_main_blabla_table LIMIT 100
Is it possible to in a single query?
If you are talking about select subquery after "from" i can say that you can do this.
You will get something like this:
SELECT * FROM
(
SELECT "schema"+'.'+"table" FROM SVV_TABLE_INFO WHERE "table" LIKE '%blabla%'
)
LIMIT 100
Unfortunately, i can't test it on yor data, but i very interested in result because i have never done something like this. If i get your question incorrect, tell me pls.
Amazon Redshift does not support the ability to take the output of a query and use it as part of another query.
Your application will need to query Redshift to obtain the relevant table name(s), then make another call to Redshift to query that table.
I have created a table in Bigquery using the data personsData.json and schema personsDataSchema.json provided by the documentation at https://developers.google.com/bigquery/docs/data#nested.
This query works fine:
SELECT children.* FROM dw_test.persons
But the following query gives the error Error: 0.0 - 0.0: Unable to determine schema of SELECT * in this query:
SELECT citiesLived.* FROM dw_test.persons
I understand that a workaround will be to simply list all the fields of citiesLived:
SELECT citiesLived.place, citiesLived.yearsLived FROM dw_test.persons
But in the case when the record has many fields, listing all the fields becomes cumbersome.
Could anyone please help?
Thank you so much.
Cant work out what I'm doing wrong here, I'm trying to copy the data from table to another in a different db. My Sql is
SELECT * INTO [dbo].[dbname].table FROM thistable
Should be really simple but it won't work.
It should be
SELECT * INTO [dbname].[dbo].table FROM thistable
Cheers!
You should use fully qualified name on both database names then it will work.
SELECT *
INTO <databasename>.<schema>.<table>
FROM <databasename>.<schema>.<table>;
I'm trying to run the following query against an Oracle DB, but the query is returning 0 records:
select * from TABLE
where upper(FIELD) like '%SEE COMMENT%'
I know this field contains many records with 'See Comment" in it. For example, here is one of the records:
=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))
I am guessing that the quotation marks in the field are messing the query up, but im not sure how to get around it. Any suggestions?
This works for me:
create table testLike (aCol varchar2(500) );
INSERT INTO TESTLIKE VALUES('abc');
insert into testLike values('=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))');
SELECT *
FROM TESTLIKE TL
WHERE upper(tl.acol) like '%SEE COMMENT%';
can you recreate?
edit:
in your query try this:
select * from TABLE
WHERE UPPER(FIELD) = '=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))';
see if that comes up with any results
Just realized there were two similarly named fields in this table, and I was choosing the wrong one.
Is there a SQL script I can run in Oracle that will tell me which fields I have permission to Update?
EDIT:
I've tried these
select * from USER_COL_PRIVS_RECD
select * from DBA_COL_PRIVS
select * from USER_COL_PRIVS_MADE
select * from ALL_TAB_PRIVS_MADE
select * from ALL_TAB_PRIVS_RECD
and the only one that has results is the last one which shows table permissions but not column permissions.
I don't have a script to do this but you should be able to get your column level privileges from the USER COL PRIVS_RECD view. This site has more info: Oracle Column Level Privileges