I am testing a select statement containing a CASE expression and I need to add a WHILE / LOOP inside one of the WHEN conditions. The logic from this statement will eventually be included inside a PL/…
Tag: oracle
Convert a running total oracle sql query to a final total
I have the following query that works and gets me the total that I need. However, i need to change it so that it just displays the final total instead of every transaction leading up to the total. I have tried converting it by group by rollup, group by group sets, using max transaction number, but my total ne…
oracle query for merge to row into one
I have a table with which showing in_time and out_time with gate number at separate row, but I wanted to show up this in one row, so I need to merge both rows into one here is result for this | …
insert values from one column to another in same table – SQL [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 2 years ago. Improve this question I want to insert values into new column from existing column in sam…
Deducting values from 2 case statements from one another
I have two CASE statements and I’m trying to deduct the value of one from another, but I can’t get the code to work. Does anyone have any suggestions where I’m going wrong? The 2 CASE statements are: and When I try to combine these I get errors (missing right parenthesis). The combined code …
SQL – Get previous amounts for each day
I’m trying to write a query that is sort of like a running total but not really. I want to get the previous weight (kg) and keep outputting that for each day until another weight (kg) is recorded then …
Pass subquery value to IN statement
In one table named prefs, I have a column named “Value” of type clob that holds this value: ‘T’, ‘L’ I need to query table attendance_code to retrieve the records where column att_code values are either T or L. The att_code column is of type varchar2. As a manual model quer…
Do Changes Made on Table Created by Joining a View and an Another Table Affect Original Table View Based On?
Suppose I have a view created on a table. If I change some record on my view, the original table is also changed too. What if I join this view with an another table and change some records on this …
Is there a shorter way to update a column with range values on Oracle SQL?
The update script will be like So that when I run the query below COLUMN_A has minimum value of 1 and maximum value of 10. Answer There is no “ranges” function in oracle, but you can emulate that using dbms_random which generates a value between 0 an 1. Multiply it by 10 so you get a value between…
How to add fictional rows to an SQL results in Oracle without à grouping
here is my issue, I’m working on an existing big report and they want me to add fictional rows with specifics values each time row in database meet a condition (let’s say status = Canceld) I simplified the query (1000 lines of SQL Code) to this : if I have two table A and B : and the query is