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?
Related
I am attempting what I thought was a very simple view. It contains one table, and just does an "ORDER BY" so I can sort the output.
I created the view on DB2 LUW using IBM Data Studio. I used the following statement:
FROM TCIS.JRGS
ORDER BY JRGSORT ASC, JRGNAME ASC;
When I attempt to execute this, I get the following error:
The specification ORDER BY, OFFSET, or FETCH clause is invalid.. SQLCODE=-20211, SQLSTATE=428FJ, DRIVER=3.69.56
Is anyone with DB2 experience able to tell me what I'm doing wrong? How do I order a view?
CREATE VIEW uses fullselect.
The SQLSTATE you get is described at the latter link. Read it carefully.
Despite the fact, that you can create a view like below, it doesn't guarantee the order of rows, if you use this view without the order by clause.
CREATE VIEW MYVIEW AS
SELECT *
FROM
(
SELECT *
FROM TCIS.JRGS
ORDER BY JRGSORT ASC, JRGNAME ASC
);
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.
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?
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
while installing sap on 3 tiered architecture, I need to install database instance (oracle) and central instance(sap) and two different machines.
after completing database install and proceeding with central instance installation, the setup is trying to access a table and fails with following error
SELECT USERID, PASSWD FROM
SAPUSER WHERE USERID IN (:A0, :A1)
OCI-call failed with
-1=OCI_ERROR SQL error 942: 'ORA-00942: table or view does not exist'
*** ERROR => ORA-942 when
accessing table SAPUSER
so I checked and found out that two cases are possible
Table does not exist or
User has no access rights to this Table
next I checked for table, and found an entry in dba_tables,
SQL> select owner from dba_tables where table_name='SAPUSER';
OWNER
------------------------------
OPS$E64ADM
but when trying to fetch data from it using select query
SQL> select * from SAPUSER;
select * from SAPUSER
*
ERROR at line 1:
ORA-00942: table or view does not exist
now I am confused, whether the table is available or not. what is the reason for this and how can it be resolved?
It depends on where you are accesing the object from,
check to see which user you are logged in as
SQL> SHOW USER
This will show which user you are logged in as,
if you are in OPS$E64ADM, the directly query using
SQL> select * from SAPUSER;
if show user show anyother user you need privilege to access it from other users, can ask dba or if you have access then run,
SQL> grant select on OPS$E64ADM.SAPUSER to username; -- the username from which you want to access the table;
then, you can acces from the other user , using,
SQL> select * from OPS$E64ADM.SAPUSER
who are you signed in as? unless it's the owner of the table you will need to change your code to include the owner ie.
select * from OPS$E64ADM.SAPUSER