My Attempt: When I have inserted one record for ref_id into the table source_Det then in the audit table I am getting two records but ideally, it should check and load only that value which is newly inserted. Current Output: Expected Output: Basically, I need to check two columns ref_id and sys_other. If only ref_id entered by user or modified
Tag: oracle
How can I count the number of zeros in all columns for a table in oracle sql
Suppose you have a database table named db_table1 with hundreds of columns and most of them contain lots of 0’s. I’m trying to count zeros for each column and divide it by the length of column so I can see the ratio of zeros in each column. The below code gives me the ratio of nulls in each column. But
How can I join 4 tables
Please help to modify the below code. I want to join these two select queries such that I can get a single output with records from two diff tables ? I have 4 tables, table_a has the user id that I have to use to search table_b1 has the foreign key for table_c which has the name that I want
How to delete defined value from the begining of character in Oracle SQL?
I have table in Oracle SQL like below: So I have in col1: always “ABC|” at the begining of each value different length of values after “ABC|” I need result like below, so I need to delete “ABC|” from begining of each value How can I do that in Oracle SQL ? Answer A simple substring operation might be easiest
condition where a ‘ ‘ and a ” not working
I wrote a SQL to query table mat from an oracle db where column A is not null. Column A is varchar and its default value is ‘ ‘. I wrote the sql below: But it return an empty data set. Then I ran: This query worked. So what is the reason? Thx. Answer In Oracle, ” means NULL. Any
PLS-00103 error while executing a sql block (Encountered the symbol “SELECT” …)
I’m trying to learn PLSQL and this is a code that I been trying to execute, When I execute the code I get the following error. I know you can assign a variable to the select statement and use that variable in IF statement, I just want to know the error in the following code. Answer OR with a variable
Not able to create a matrix in PL/SQL using nested tables
I was trying to create a matrix in PL/SQL using nested tables as such: firstly, I create a table type that is able to store varchars (that in my case is name lista_principala) secondly, using the previously declare table type lista_principala I try to create a table type that contains items of type lista_principala. I don’t think that I’m wrong
PLS-00225 subprogram or cursor ” reference is out of scope when try to read column names
I’m trying to return the column names and the value as a pair key/value like this: column_name | column_value dep_id | 1 dep_name | ‘Test’ dep_create_date | ’08-25-2021′ When I execute this block, I got the following error message: Error report – ORA-06550: line 6, column 22: PLS-00225: subprogram or cursor ‘C_DEPT’ reference is out of scope ORA-06550: line 6,
Rounding time to aggregate entries close in time
I am trying to sum together content_len that are entered into the database a few seconds apart (colour coded). The table currently breaks into a new row once the character count hits 999, and inserts each overflow a few seconds apart. Due to errors, the overflow can be timestamped earlier than the previous body. My current attempt is to round
Assign min value or max value based on a value change
HAVE WANT (Get min date when ct_val within the ID group is 0 across that ID group OR get max date within the ID group where ct_val is not 0 (that is it may contain a 1) across that ID group). For instance, if the ct_val within an ID group is 1, pick the maximum dt where ct_val within that