results not displayed after running sql query in hive - hadoop

Created table and loaded data from txt file to this table. select * from tablename displays all record however when i run select statement with condition, query runs successfully (no error prompts by hive) however no results are displayed. Table exists in the folder.
I ran the below two queries-
select * from plan1 where contid = "%H0001%";
select * from plan1 where contid = "H0001";
any thoughts? TIA

Related

Select from Oracle Function

Select From Oracle Function
I have a function that return an oracle table of object type.
When I run the function it runs successfully but I need to output its data and so for that I use the code select * from table(my_func_name); however this is coming through with an error that says table or view does not exists.
So I would like to get assistance as to why could this be happening
select * from table(my_func_name);
I want to get results as a table.

hive create view problem: internally casting numbers to something else

I'm facing an issue in hive while creating view from a partitioned table. If I use the command below:
create view test_view as select * from table where and year=2000 and month=01 and day=02;
The view gets created but the below selection results in 0 records:
select count(*) from test_view where day='02';
Whereas, the below selection will work just what it's meant to do:
select count(*) from test_view where day='2';
The following command also gives the count(*) result properly:
select count(*) from test_view where day=2;
The important thing here is that day=02 is a physical partition in the actual table, which is fine to the understanding. It's somehow the view creation is interpreting the input integers.
Anyone got any ideas on this?

sqldeveloper query other users

I have a database that has say 100 other_users.
I am logged in as the database owner and I want to query a specific table in all the other users schemas.
So let's say each schema has a table called propertyvalue.
I want to find out which schemas have this value set to TRUE.
Is there a way I can run a select statement against all the other users schemas without specifically pointing to an individual schema.
Something like:
select * from otherusers.propertyvalue where value = 'TRUE', which doesn't work as I have tried that.
Thanks.
You can write a statement that will write select statements to do this
SELECT 'SELECT '||owner||'.'||table_name||'.'||column_name ||
' FROM '||owner||'.'||table_name||';'
FROM All_Tab_Cols atc
WHERE atc.column_name = 'PROPERTYVALUE';
Run this statement as a user with select privilege on the table and then run the selects that are the output.
However tables with multiple rows will return all rows. Are you expecting that there is only one row in each table?
You could also write an anonymous block that will open a cursor with the same statement and output the results to a file/table/output.

Seeing double entries in v$sql for a query run once

I recently was trying to understand Oracle's data dictionary tables and I noticed something rather strange.
When I run a query like
select * from table where id in (?, ?);
just once, I notice that there are 2 rows created in v$sql for the same query. why is that?
However, if i run something like
select * from table where id = 10;
I see only a single row being created.

Error while select from a view in Teradata

I am getting error while doing a simple select * from a view. created a view successfully but getting this error on select :
non-aggregate values must be part of the associated group
I tried to insert the result set in table and it was successful and even select worked for that table.
For same set of select statements the view creation was successful and the select failed(select * from viewname)
What is the reason for this?

Resources