oracle9i

Get a list of all functions and procedures in an Oracle database

佐手、 提交于 2019-11-28 16:11:54
I'm comparing three Oracle schemas. I want to get a list of all the functions and procedures used in each database. Is this possible via a query? (preferably including a flag as to whether they compile or not) Ideally it would be great to have a single query with a flag that states whether the function/procedure is in each schema. But even just the first bit would be better than manually inspecting each schema. SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') The column STATUS tells you whether the object is VALID or INVALID. If it is invalid, you have to try a

How to select only 1 row from oracle sql?

安稳与你 提交于 2019-11-28 15:01:29
问题 I want to use oracle syntax to select only 1 row from table DUAL . For example, I want to execute this query: SELECT user FROM DUAL ...and it'd have, like, 40 records. But I need only one record. ...AND, I want to make it happen without a WHERE clause. I need something in the table_name field such as: SELECT FirstRow(user) FROM DUAL 回答1: You use ROWNUM. ie. SELECT user FROM Dual WHERE ROWNUM = 1 http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm 回答2: I found this

the best way to track data changes in oracle

五迷三道 提交于 2019-11-28 07:36:55
问题 as the title i am talking about, what's the best way to track data changes in oracle? i just want to know which row being updated/deleted/inserted? at first i think about the trigger, but i need to write more triggers on each table and then record down the rowid which effected into my change table, it's not good, then i search in Google, learn new concepts about materialized view log and change data capture, materialized view log is good for me that i can compare it to original table then i

SQLPLUS command line with Windows batch file

别等时光非礼了梦想. 提交于 2019-11-28 03:43:10
问题 I want to create a batch file which will open the SQLPLUS [CLI] and will execute some stored sql file and will also store the output to text file. So I've created this batch file [which does not work]. These SQL file contains SQL which returns the max number from a table. sqlplus scott/tiger@DB @sql1.sql>data1.txt @sql2.sql>data2.txt The problem is it does not executes the SQL files after opening the SQLPLUS Windows XP Oracle 9i 回答1: What about native Sql*plus spooling? run.bat: sqlplus hr/hr

Oracle SQL Developer: How to transpose rows to columns using PIVOT function

我只是一个虾纸丫 提交于 2019-11-28 00:57:25
问题 I'm attempting to create a query to transpose rows into columns using the PIVOT function. This is the contact table I want to transpose into rows: PARTYID CONTACTTEXT CONTACTTYPECD ---------- ------------ ------------- 100 0354441010 1 100 0355551010 2 100 0428105789 3 100 abc@home.com 4 My intended result: PARTYID PHONE FAX MOBILE EMAIL ---------- ------------ ------------ ------------ ------------ 100 0354441010 0355551010 0428105789 abc@home.com My query: SELECT * FROM ( SELECT partyId,

Hibernate > CLOB > Oracle :(

自古美人都是妖i 提交于 2019-11-28 00:25:17
I am trying to write to an Oracle clob field a value over 4000 characters. This seams to be a common issue but non of the solutions seem to work. So I pray for help from here. Down and dirty info: Using Oracle 9.2.0.8.0 Hibernate3 implementing pojo's with annotations Tomcat 6.0.16 Oracle 10.2.x drivers C3P0 connction pool provider In my persistence.xml I have: <persistence-unit name="DWEB" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.archive.autodetection" value="class"/> <property name="hibernate

Get a list of all functions and procedures in an Oracle database

社会主义新天地 提交于 2019-11-27 09:46:26
问题 I'm comparing three Oracle schemas. I want to get a list of all the functions and procedures used in each database. Is this possible via a query? (preferably including a flag as to whether they compile or not) Ideally it would be great to have a single query with a flag that states whether the function/procedure is in each schema. But even just the first bit would be better than manually inspecting each schema. 回答1: SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE',

ORA-00942: table or view does not exist (works when a separate sql, but does not work inside a oracle function)

爱⌒轻易说出口 提交于 2019-11-27 09:01:43
When I have a sql statement like select * from table1 , it works great, but as soon as I put it into a function, I get: ORA-00942: table or view does not exist How to solve this? There are a couple of things you could look at. Based on your question, it looks like the function owner is different from the table owner. 1) Grants via a role : In order to create stored procedures and functions on another user's objects, you need direct access to the objects (instead of access through a role). 2) By default, stored procedures and SQL methods execute with the privileges of their owner, not their

ORA-01008: not all variables bound. They are bound

醉酒当歌 提交于 2019-11-27 08:35:27
I have come across an Oracle problem for which I have so far been unable to find the cause. The query below works in Oracle SQL developer, but when running in .NET it throws: ORA-01008: not all variables bound I've tried: Changing the Oracle data type for lot_priority (Varchar2 or int32). Changing the .NET data type for lot_priority (string or int). One bind variable name is used twice in the query. This is not a problem in my other queries that use the same bound variable in more than one location, but just to be sure I tried making the second instance its own variable with a different :name

Oracle PL/SQL - How to create a simple array variable?

偶尔善良 提交于 2019-11-27 02:30:38
I'd like to create an in-memory array variable that can be used in my PL/SQL code. I can't find any collections in Oracle PL/SQL that uses pure memory, they all seem to be associated with tables. I'm looking to do something like this in my PL/SQL (C# syntax): string[] arrayvalues = new string[3] {"Matt", "Joanne", "Robert"}; Edit: Oracle: 9i You can use VARRAY for a fixed-size array: declare type array_t is varray(3) of varchar2(10); array array_t := array_t('Matt', 'Joanne', 'Robert'); begin for i in 1..array.count loop dbms_output.put_line(array(i)); end loop; end; Or TABLE for an unbounded