here is my problem i do have a query the returns to me this table what i need is to sum all the organic_value where the previa is the same + financial_value of each month so the final table would be any tips how to tackle this problem? Answer That’s a window sum:
Tag: oracle
Many rows as a result of SELECT SQL
The table consists of the Record and Record author fields. There is an employee table with the Employee and His manager fields. It is necessary to read records from the first table that belong to a specific manager or his employees. I tried like this: Issued: ORA-01427: single row subquery returns more than o…
SQL query to set CHECK constraint on a column based on the value in other column
I need to set a CHECK constraint on a column based on the value in other column (both within the same table) Like when COLUMN A is NULL, COLUMN B should be NULL But if COLUMN A has values 1 or 2 or 3 then COLUMN B should definitely have a date value. Answer Define B as a date. And
Oracle SQL count same field across multiple tables
I have an oracle database that has the same name field in multiple tables. It kind of looks like this: The common field in each table can either be ‘yes’, ‘no’, or null. I’m trying to get the value counts of all the fields in one query, but I can’t figure it out. Basically …
passing sys_refcursor from function to sys_refcursor out parameter in procedure
I have problem with outputting results from the sys_refcursor returned from the function stored in the variable crs_scenarios. I then want to pass this collection of data to the output parameter pout_result. I get the error PLS-00487: Invalid reference to variable ‘POUT_RESULT’. Can you advise me …
Sum up all values from a list PLSQL
I want to sum up all values from a INDEX BY TABLE list. In the list there are values like this: 24000, 4500, 7890 and so on. This is the code: Answer Lets assume that you have an associated array and you want to sum up the values within it. And, lets also assume that the associative array’s index is
Updating joint query in Oracle
I’m trying to update the name on the trade table according to the user table however as we have so many trades I don’t want my query to update each and every trade. only the ones that have the …
SQL count products
I have table: name product john beer john milk john tea john beer emily milk emily milk emily tea john beer i need select from this table, when output will be: name …
How to copy all records and add some changes in the same table in OracleDB
I would like to copy all records into the same table with some changes. Is someone tell me a good way? I tried to this. but Not Ended error happen. How can I fixt it? ORA-00933:”SQL command not properly ended” 00933. 00000 – “SQL command not properly ended” *Cause: *Action: Answe…
Single-row subquery returns more than one row BUT with one row
“CityJail” schema. I am supposed to find each appeal that has a less than the average number of days between the filing and hearing dates. Here is my code: I get an error: ORA-01427: single-row subquery returns more than one row 01427. 00000 – “single-row subquery returns more than one…