Skip to content

Tag: oracle

How to calculate total time from date column in Oracle

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

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…

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

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…

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 clob…

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 …