Skip to content

Tag: oracle

how to divide each row by the sum of those rows?

I have a table CREDITS with these columns: DAY_OPERATIONAL TOTAL_LOAN CREDITS_PERCENT I should multiply each row’s TOTAL_LOAN and CREDITS_PERCENT then divide to SUM(TOTAL_LOAN) in that DAY_OPERATIONAL. My code is not working. How can I achieve this? How do I need to use group by properly? Answer This is…

How can i grant an execute statment

I want to grant TRIGGERS, FUNCTIONS and PROCEDURES to a role. I have the code to do it with procedure but with triggers and functions it not work. Answer User owns tables, functions and procedures. That user created a role and wanted to grant execute on various objects to the role. for triggers, it doesn&#821…

How do I find data from this day exactly one year ago in oracle?

Merry Christmas, I am using the below query to get the prices, but my requirement is to get the data for last one year from trunc(sysdate). i have tried using DATEADD function but its gives me an error cast(p.asof as DATE) = cast(DATEADD(Year, -1, GETDATE()) as DATE) Can anyone please help, what all changes i…

What’s wrong with this PL/SQL Trigger?

I have this table, and I want to create a trigger on Magazine, that verifies “after insert” if the name of the Magazine inserted is either Vogue or People. If it’s not one of them, it gets deleted. Table: MAGAZINE (ISBN, MAG_NOM, PRIX_Mois); My trigger: But the problem is my teacher told me:…