When doing a MERGE in Oracle SQL how can I update rows that aren t matched in the SOURCE

0 votes

I have a main database and a report database, and I need to sync a table from main into report.

However, when an item gets deleted in the main database, I only want to set an IsDeleted flag in the report database.

What is an elegant way to do this?

I'm currently using a MERGE statement, like this:

MERGE INTO report.TEST target
USING (SELECT * FROM main.TEST) source
   ON (target.ID = source.ID)
WHEN MATCHED THEN
    UPDATE SET (target... = source...)
WHEN NOT MATCHED THEN
    INSERT (...) VALUES (source...)
;

The WHEN NOT MATCHED statement gives me all NEW values from main, but I also want to update all OLD values from report.

I'm using Oracle PL/SQL.


 

Nov 4, 2022 in Others by gaurav
• 23,260 points
1,369 views

1 answer to this question.

0 votes

I see you asked it a long time ago, hope still this can help.

I had the same problem and this is how I solved it. (showing on your code)

@State private var minimum: Double = 98.0
@State private var maximum: Double = 1000000.0

var filteredProducts: [Product]

var body: some View {
    List {
        Section(header: Text("Filters")){
            DisclosureGroup("Price range") {
                Slider(value: $minimum, in: 98...maximum) {
                    Text("\(minimum)")
                } minimumValueLabel: {
                    Text("min")
                } maximumValueLabel: {
                    Text("\(maximum, specifier: "%.0f")")
                }
                
                Slider(value: $maximum, in: minimum...1000000) {
                    Text("\(maximum)")
                } minimumValueLabel: {
                    Text("\(minimum, specifier: "%.0f")
                } maximumValueLabel: {
                    Text("\(maximum, specifier: "%.0f")")
                }
            }
        }
    }
}

Basically, give your Min value Slider your @state max value and vice versa for the Max value Slider. 

answered Nov 7, 2022 by gaurav
• 23,260 points

Related Questions In Others

0 votes
1 answer

How do I UPDATE from a SELECT in SQL server?

In SQL Server, it is possible to insert ...READ MORE

answered May 30, 2022 in Others by anisha
• 140 points
590 views
0 votes
1 answer

How can we UPDATE from a SELECT in an SQL Server

We can firstly use SELECT statement to fetch ...READ MORE

answered May 27, 2022 in Others by Avinash
• 240 points
4,729 views
0 votes
1 answer

How can I use a command button in excel to set the value of multiple cells in one click?

Try this: Private Scan As Integer Private Sub CommandButton1_Click() ...READ MORE

answered Oct 24, 2022 in Others by narikkadan
• 63,600 points
782 views
0 votes
1 answer

How can I store the data of an open excel workbook in a collection using BluePrism?

To do what you want is like ...READ MORE

answered Nov 24, 2022 in Others by narikkadan
• 63,600 points
1,362 views
0 votes
1 answer

Automating Oracle script with nolio

Depending upon the details of your script ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by ajs3033
• 7,300 points
1,043 views
0 votes
1 answer

Is there any boolean type in Oracle database?

Nope. I don't think there is one But ...READ MORE

answered Oct 10, 2018 in Database by Neha
• 6,300 points
983 views
0 votes
1 answer

Please name some online websites to compile and run PL/SQL?

For executing Oracle SQL queries and PL/SQL ...READ MORE

answered Feb 11, 2022 in Database by Neha
• 9,020 points
1,434 views
0 votes
1 answer

ORACLE LIVE SQL IMPORT CSV DATA (live oracle sql)

Convert CSV to SQL http://www.convertcsv.com/csv-to-sql.htm This programme may be ...READ MORE

answered Feb 11, 2022 in Database by Neha
• 9,020 points
8,170 views
0 votes
1 answer

How to import excel file in Oracle SQL live

Hello, there are a few steps You'll ...READ MORE

answered Feb 18, 2022 in Others by gaurav
• 23,260 points
2,142 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP