I need to query last month data from a database. So I need the first and last date of previous month to be able to make the “between” SQL query. First date starts always from 1 of course, …
Tag: oracle
oracle sql max value
i have a requirement, i need to find max only one val from each department,i need only one value even 2 person have same max value drop table tst; create table tst(val number,dept varchar2(20),name …
Sort alphanumeric ID number
I have a database that every transactions get a alphanumeric ID. By when I write my query and use Order by it give me a wrong sequence. For example: TRN_ID TRNDTE 000002DAAW 2020-09-12 03:45:24 …
Use rownum to indicate what rows I have pulled back
I have table of people, with firstname and lastname. firstname lastname a a b b c c d d e e f f g g h h i i j j I want to query from a specific point. For example. SELECT FIRSTNAME, …
Dynamic query to find all the table DML activity in all the table oracle
Hi I need to search the DML activity of specified list of tables in a schema single query since it is time consuming and hard to run individual queries ,so i am trying to prepare a dynamic sql to fetch max(ora_rowscn),SCN_TO_TIMESTAMP(max(ora_rowscn)) from all the tables so that i can use a filter and select …
How to use only one query (no sub query) to get the rows which mach the requirement?
I need some suggestions for my case. First, I have a table (T1) like this: I want to have a table like this: The issue is, if I can use only one query (without any sub query), what I can do? I tried like this: Select * case when Flag = 0 then ‘F’ when Flag = 1 then ‘T’
How to get the latest date time record in an sql query with a where clause?
I have two tables : RO_LAMEL_DATA and RO_MAIN_TABLE. RO_MAIN_TABLE includes all the serial numbers (serial_nr) for the productions which have a record key (record_key). RO_LAMEL_DATA has several records (on the same day) for each record key such as machine status (machine_status) with a date time value (pr_da…
Is there a way to continue on the next row after listagg() runs out of space (>4k)?
I would like to change a table that has a number of values per week, to having all values in one row per week. But when I use listagg() I run out of space. I can’t change the maximum string size (ALTER SYSTEM SET max_string_size=extended SCOPE= SPFILE), and I don’t want to truncate the resulting s…
not in in select query
I have similar query in my project. I have been told to find other way to remove not equal to, because index is not used if you do so. I have no other filter condition, can I do some work around to fool optimizer? Answer I have been told to find other way to remove not equal to, is generally
CASE (IF ELSE )
if else statement in oracle with condition Answer What you posted doesn’t make sense; as if that CASE was supposed to be in the WHERE clause, e.g.