I would like to get the hourly average of two columns. The type of the columns is timestamp. I try this: I do not know if this is the right way to go at all. But the query is not correct. I get this error: 00923. 00000 – “FROM keyword not found where expected” In the end I would like
Tag: oracle-sqldeveloper
Combine 2 similar update queries into one query
Is there a way by which I can combine the above two queries (updating the same table) into one single query? Answer You may use a case expression to achieve this eg.
How to count a foreign key and use it to sort the primary table?
I have 2 tables: Product (prod_id, prod_name, vend_id) Vendor (vend_id, vend_name, vend_state) I am trying to make a query that will give me a list of the vend_name for every vendor that supplied only one product. vend_id is a foreign key in Product, and I would like to count how many instances of each vend_id are in Product and then
How to generate INSERT Statements with Subqueries in Oracle SQL Developer?
I need to move some data from Environment A to Environment B. So far, so easy. But some of the columns have FK Constraints and unfortunately the lookup data is already on Environment B and has different PKs. Lucky me, there are other unique columns I could do a mapping on. Therefore I wonder if SQL Developer has an export
Oracle SQL: ORA-01858 error on date fields
I have many tables with a date in their name. For example MY_TABLE_2021_06_01, MY_TABLE_2021_06_02, etc. I’m trying to extract the date from the table name and see if any tables are more than an year old. This is my code: The above code works fine if I don’t include the where clause where table_date < trunc(sysdate)-365. If I run the
Oracle 11g SQL Query – Specify which duplicates to Exclude from Select Statement
I have a question about excluding duplicate values with my Oracle SQL query. Using select distinct does not work in this case. I only want to select one row for each event#, the row where Mobile = Yes. Actual Result of Current Query: Desired Result: In this ideal result, one of the rows for Event# 1 has not been selected
How to set an autoincrement composite primary key in oracle19c?
I want to create a table, with composite primary key and autoincrement, in Oracle 19c, like this: How I do it? Answer Create trigger on this table to achieve this result. Assume table name is test123
How to combine 4 sql queries into a single query with good performance?
I have a problem to solve. First I split this problem into parts and so I wrote four queries separately but now I need to put them together as if it were a single call to return a single result. How can I do this? 1) I select purchases according to branch and store 2) I validate if the promotional
Invalid number when converting a date to another format
I have this query, and i am trying to format all dates for the two columns mentioned in the query below to the format mentioned: and i want to convert the results from timeone and timetwo to another date format DD-MM-YYYY HH:MIPM but when I run the query I got back invalid number. The datatype of the timeone and timetwo
Updating all the record for a column in a table with value from another table
Hi I want to update all the values of RequestId column of IIL_CHANGE_REQUEST Table with the RequestId of TABLE_NAME_4MINS Table where REQUESTBY column in both tables are same. I am trying to do this in oracle daatabalse(sql developer) My query: But every time I do this I get an error saying: Error report – ORA-01427: single-row subquery returns more than