Skip to content

Tag: oracle

Oracle View loop on specific tables only

I got many tables of which some end with digits (date). Due to technical reasons I had to create a view on every table (just a workaround) The current state is something like: All it does is creating views for every table which begins with ‘XXX_’. Its almost what I need. But now, sometimes tablena…

How to regex match multiple items

I have a reviews table as follows: r_id comment 1 Weight cannot exceed 40 kg 2 You must not make the weight go over 31 k.g 3 Don’t excel above 94kg 4 Optimal weight is 45 kg 5 Don’t excel above 62 kg 6 Weight cannot exceed 7000g What I want to select is the weight a r_id’s cannot exceed.

Oracle sum group by column range with different starting points

I have below sample data. i want to find the total sum(amount) of each respective user_x but starting from sdate assigned to each user. the sdate in the respective users does not change What i have tried below returns all the results, i just want one line result for each user_x This is what i want How can i d…

Add subquery in query – Oracle SQL

My query return all days in month. How get all days from query where DAY_ID not in ==> (Select day_id from table1) Eg. table1 return 5,10,15 Query resault need to display all days except 5,10,15 Answer You can generate your calendar and then use NOT EXISTS: Which, for your sample data: Outputs: DAY DAY_ID …

To check whether entered number is odd or even in PL/SQL [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…

How to use like and in together in sql statement?

If I use this code, I get an error ORA-00936: missing expression There seems to be no error logically, but I am wondering which part of the code above is wrong. I’m also curious about a way to replace LIKE IN. Answer Removing LIKE from your current WHERE clause leaves it valid: It isn’t clear from…

ORA-00907: missing right parenthesis again

Why? I have used before, I don’t know if it makes a difference but… what’s is wrong with this? Answer multiple issues : Identity column in Oracle are created using generated always as identity Int datatype doesn’t need length. referencing to another table is based on columns , you need…

lock and get next n records from table in oracle

I have a oracle table PHONE_NUMBER which has 2 columns PHONE and STATUS U stands for used , O is open/UnUSED . in my input I will get n as input number , which signifies the number of phones I want to reserve(update status to U from O ) I want a query that will lock(something like SELECT FOR UPDATE)