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…
Tag: oracle
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…
When to create a subtype or simply use optional attributes
I’ve been practicing with Oracle SQL Developer for some time using school assignments and encountered some kind of dilemma while doing the Entity Relationship Diagram for one of those, here’s my issue: On the assignment they mention that there’s a CLIENT entity with certain attributes, and i…
Is a rollback necessary when insert of a single database record fails?
I am not too familiar with database transactions. I was wondering about a situation where a single record is being inserted into a database. Is a transaction necessary. If so, if the insert of the one record fails, is a rollback necessary? I am asking this related to JDBC but is can be in a general database s…
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)