oracle

How to Select only one unique record from the Table using Distinct

my table have several records which has the same MemberID. i want to result out only one record. select DISTINCT(MemberID) from AnnualFees; then result will come. but i want to show the other column data also but when i do this select DISTINCT(MemberID),StartingDate,ExpiryDate,Amount from AnnualFees; all the details including s...

How to prevent an Insert Trigger from being fired when no row is inserted ?

I have a TABLE1. On this table I created a trigger : AFTER INSERT OR UPDATE OR DELETE Now, if I do an insert which doesn't insert anything, the trigger will still be fired : insert into TABLE1 select * from TABLE1 where 1=0; This query will insert NO ROWS but yet the trigger is still fired. Is there a way to avoid this ? Is this no...

executing Oracle stored procedures using ADO (c#)

Im trying to call a Oracle stored proc from a C# application using the following code Connection conn = new Connection(); Recordset rs = new Recordset(); conn.Open("Provider=MSDAORA;User Id=username;Password=password;Data Source=DB;", null, null, 0); ; rs.Open("sproc 'abc', 'xyz'", conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockType...

auto-fold Oracle inline views in Vim using .vimrc

I've seen magical Vim commands before that you could add to your .vimrc to have folds created upon opening a particular type of file. I remember having such code that would create the folds, upon opening the file, at every Ruby method and class. Then, with one command, I could collapse all those method folds. Does anyone know how to d...

Variables in PL/SQL

I am working on a rather large SQL script to be used with Oracle, but I'm running into an issue. First, let me outline how the script operates. Declare variables`CUSTOMERID NUMBER;``SERVERID NUMBER;` Create a customer if it doesn't exist `SELECT ID INTO CUSTOMERID FROM CUSTOMER WHERE NAME = 'The Customer I just Inserted';` Create the s...

Oracle listener hangs when trying to stop it.

I tried to stop the oracle listener by issuing lsrntcl stop but it just hang and doesn't complete the command successfully. How do i determine the cause of the issue? Thanks ...

Why does this cause an ArithmeticException in C# when SQLPlus is all ok

I have a view connecting 4 tables CREATE VIEW BookCopyInfo AS SELECT bc.BookCopyID, b.BookTitle, m.FirstName || ' ' || m.LastName AS BorrowedBy, l.expectedReturnDate, (SYSDATE - l.expectedReturnDate) AS NoOfDaysLate FROM Book b, Member m, Lending l, BookCopy bc WHERE b.BookID = bc.BookID AND l.MemberID = m.MemberID AND l.BookCopy...

Export Data to Flat File

I have a newbie question - I searched the web for a long time but I cannot find any answers. I understand that all packages,procedures and stored program units are stored in system tablespace or sysaux tablespace. My requirement is to copy a few schemas from a source database into a target database. Is it enough to exp the schemas and b...

Cannot use Max with Count in SQL*Plus

this is my sql statement i get this error. but when i use only Max to single and without displaying other results it works. can someone help me SELECT cat.CategoryName,sb.SubCategoryName,MAX((COUNT(bs.BookID))) FROM Category cat,SubCategory sb, Book_Subcategory bs WHERE cat.CategoryID = sb.CategoryID AND sb.SubCategoryID = bs.SubCat...

Getting ORA-12560 with Oracle Express 10g

I started to receive this error while I`m using C# with Oracle 10g. ORA-12560 and I really need to solve it as I`m running out of time on my grad project. ...

How do i dynamically create a job schedule in a trigger?

I am creating a library system. When a book is reserved, i want it to automatically change the status back to "Available" in 3 days if the reserved user does not borrow it. I can create a trigger to fire when the status is changed to "Reserved" but I am lost on creating a job to happen in 3 days and change the status back to "Availabl...

is this function true PL/SQL ?

Hello, is it used in the correct form in PL/SQL ? SELECT ename ,hiredate , TO_CHAR(TRUNC(ADD_MONTHS(hiredate,6),'MONTH'),'Le DD MONTH YYYY') AS "Révision" FROM emp thx ...

Count the number of days between today & the hiredate in Oracle SQL?

Hello, how can i count the number of days between (sysdate) & a column called hiredate in PL/SQL. Thanks. ...

How should I implement a database cron job logger?

I use PHP and Oracle, with crontab executing the PHP scripts at scheduled times. My current logging/auditing solution involves simple log files. I'd like to save my cron execution logs to a database instead. Right now I'm trying to design the process so that when a cron job starts I create a record in an CronExecution table. Then eve...

Error FRM-30113

I use Oracle Form Builder 6i. Suddenly I receive 3 errors that I can't handle: Error Frm-30113: block must have non-query-only database item.block capa_problems. FRM-30362 Initialize value does not match available list elements. list v_impact_proc_area Item : v_impact_proc_area Block : search_block Form: problem_review_app...

Any tools to export the whole Oracle DB as SQL scripts

Hi all Gurus Here is my problem, I wants to create a baseline on our development Dateabase (Oracle 10g), and check into our svn for version control, and after this we will use liquibase to help us manage the incremental database changes. My problem is how should I create baseline of Oracle 10g? the database now consists of 500+ tables...

oracle application directory problem - jdeveloper

Hi, i'm working on a project in jdeveloper. when i try to test a db connection file, an error occurs below: C:\OA_HTML\TestDbcConn.jsp:0: error #704: cannot access directory oracle\apps\fnd\common; verify that directory is reachable from classpath and/or sourcepath i searched this file in my computer, there are some directories like t...

Get ID of last inserted record in oracle db

I want to retrieve the id of a newly inserted record with an auto incrementing id column (using the sequence and trigger method). What is the standard way to do this? ...

SQL to delete the oldest records in a table

I'm looking for a single SQL query to run on an oracle table that will retain n number of records in a table and delete the rest I tried the following delete from myTable where pk not in (SELECT pk FROM myTable where rownum <5 order by created DESC) But it appears that I cannot have order by in the nested select. Any help appreci...

Updating SQL table with calculations regarding previous rows

Hello, I'm trying to fix some errors on a big database of stock exchange data. One column (quantity) has the traded volume on each tick, and other column stores the cumulative volume (i.e., the sum of the previous ticks of the day). This second column is wrong in some cases (not a lot, so we can safely assume that no to adjacent ticks a...