I have a table where i have some log like this. and output is like below But I want to have one more column which will give me total time like below I have tried to minus both time but not getting proper result. The output i am getting is below Answer Don’t convert the dates to strings. That makes
Tag: oracle
count total no of people in school
database for school their are two main table student and teacher the creation of table is almost like this create table students ( students_id int, year int ) create table Teacher ( Teacher_id int, year int ) but i what to count total number of people(student + teacher) in each year. example students students_id year 01 2020 02 2019 03
Can’t enable a foreign key in ORACLE SQL
So I have a disabled foreign key (Manager_ID in the table Employees) and I wanted to enable it, but I get this error: ORA-02298: cannot validate (my_username.EMP_MANAGER_FK) – parent keys not found And this is the code: Here’s how the table was created: Answer There are values in the column that are invalid from the foreign key’s perspective. Assuming that
Oracle: Id Not in another table
I have following two tables, airport and flying I would like to get airport_id where flying_id present in flying table but not present in airport table. I rote the following query using nested select query. Is there anyway I can improve without writing nested? Answer There are two ways. LEFT JOIN NOT EXISTS
Including only one row in sql [closed]
What I’m trying to do is take these records that looks like this: ID NAME STARTDATE ENDDATE EnrollmentMonth 1 PETER 20200705 20200729 20200701 1 TONY 20200730 99991231 …
Insert 2 select in same insert SQL
i have a problem, i would like use 2 select to insert in new table but i don’t know if it’s possible… my code : I would like insert the second part ( select COLONNE01….) in the first part instead of “INSERT HERE” DATA OLD TABLE : COLUMNS 1 (“PKID1″, one”,”two”,”three”) COLUMNS 2 (“PKID2″,”one”,”two”, “three”) New TABLE : (PKID1, one,
ORACLE SQL – How to add commas and dollar sign to a table value
For this, I am trying to display my table values in a currency format, here’s my code; This is what I get; This is what I want; So pretty much format the values with a ‘$’ sign and automatically add a ‘,’ where appropriate. I am very new to this so I apologize if this sounds dumb in any way
Oracle Procedure call too long string
Hello I have one procedure like my problem is that P_SICIL or P_EXISTS can be too long so all length can be more then 4000 characters. when I call procedure it gives below error ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 14103, maximum: 4000) if I dont use to_char for clobs then I
Why am I violating an integrity constraint? (ORA-02291)
When I try to alter one of my tables to set one of it’s rows as a foreign key, I get the following error: “ORA-02291: integrity constraint (SYSTEM.M_FRAN_FK) violated – parent key not found” This error only occurs when I insert a row into the database with a none-null value. I’m trying to understand why it’s doing this and what
Update table inside a loop in a procedure pl/sql
So i want to hire a new manager for a department. This procedure has 2 parameters, the department name i want to change, and the new id for manager (taken from employee’s id). So to change it, i need …