The provider is not compatible with the version of Oracle client

I’ve been looking into this problem further, and you simply need to grab all the appropriate DLL’s from the same downloaded version of ODP.Net and put them in the same folder as your Exe file, because ODP.Net is fussy about not mixing version numbers. I’ve explained how to do this here: http://splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c Here’s the gist … Read more

Comparing Dates in Oracle SQL

31-DEC-95 isn’t a string, nor is 20-JUN-94. They’re numbers with some extra stuff added on the end. This should be ’31-DEC-95′ or ’20-JUN-94′ – note the single quote, ‘. This will enable you to do a string comparison. However, you’re not doing a string comparison; you’re doing a date comparison. You should transform your string … Read more

How can I confirm a database is Oracle & what version it is using SQL?

Run this SQL: select * from v$version; And you’ll get a result like: BANNER —————————————————————- Oracle Database 10g Release 10.2.0.3.0 – 64bit Production PL/SQL Release 10.2.0.3.0 – Production CORE 10.2.0.3.0 Production TNS for Solaris: Version 10.2.0.3.0 – Production NLSRTL Version 10.2.0.3.0 – Production

Escaping ampersand character in SQL string

Instead of node_name=”Geometric Vectors \& Matrices” use node_name=”Geometric Vectors ” || chr(38) || ‘ Matrices’ 38 is the ascii code for ampersand, and in this form it will be interpreted as a string, nothing else. I tried it and it worked. Another way could be using LIKE and an underline instead the ‘&’ character: node_name … Read more

How do I list all tables in a schema in Oracle SQL?

To see all tables in another schema, you need to have one or more of the following system privileges: SELECT ANY DICTIONARY (SELECT | INSERT | UPDATE | DELETE) ANY TABLE or the big-hammer, the DBA role. With any of those, you can select: SELECT DISTINCT OWNER, OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_TYPE = ‘TABLE’ AND … Read more

How to drop all user tables?

BEGIN FOR cur_rec IN (SELECT object_name, object_type FROM user_objects WHERE object_type IN (‘TABLE’, ‘VIEW’, ‘MATERIALIZED VIEW’, ‘PACKAGE’, ‘PROCEDURE’, ‘FUNCTION’, ‘SEQUENCE’, ‘SYNONYM’, ‘PACKAGE BODY’ )) LOOP BEGIN IF cur_rec.object_type=”TABLE” THEN EXECUTE IMMEDIATE ‘DROP ‘ || cur_rec.object_type || ‘ “‘ || cur_rec.object_name || ‘” CASCADE CONSTRAINTS’; ELSE EXECUTE IMMEDIATE ‘DROP ‘ || cur_rec.object_type || ‘ “‘ || … Read more

Number of rows affected by an UPDATE in PL/SQL

You use the sql%rowcount variable. You need to call it straight after the statement which you need to find the affected row count for. For example: set serveroutput ON; DECLARE i NUMBER; BEGIN UPDATE employees SET status=”fired” WHERE name LIKE ‘%Bloggs’; i := SQL%rowcount; –note that assignment has to precede COMMIT COMMIT; dbms_output.Put_line(i); END;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)