oracle10g

SQL to get distinct record for a combination of two column (Irrespective of order)

别来无恙 提交于 2019-12-02 21:17:19
问题 Consider the below Table structure and data CREATE TABLE Distance( source VARCHAR(20), destination VARCHAR(20), distance INTEGER ); Select * from Distance; source destination distance ======= =========== ====== Chennai Mumbai 500 Mumbai Chennai 500 Mumbai Bangalore 500 Bangalore Mumbai 500 Goa Mumbai 100 Mumbai Goa 100 Kolkata Goa 1000 I need the output to have single record for 2 cities if repeating, i,e, any one record among the below 2 is fine. Chennai Mumbai 500 Mumbai Chennai 500

How do I find out when a stored procedure was last modified or compiled in Oracle?

前提是你 提交于 2019-12-02 20:33:44
I'm preferably looking for a SQL query to accomplish this, but other options might be useful too. SELECT LAST_DDL_TIME, TIMESTAMP FROM USER_OBJECTS WHERE OBJECT_TYPE = 'PROCEDURE' AND OBJECT_NAME = 'MY_PROC'; LAST_DDL_TIME is the last time it was compiled. TIMESTAMP is the last time it was changed. Procedures may need to be recompiled even if they have not changed when a dependency changes. SELECT name, create_date, modify_date FROM sys.procedures order by modify_date desc Following query will do in Oracle SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = 'OBJ_NAME' ; 来源: https://stackoverflow.com

How to reconfigure Oracle 10g xe on Linux

点点圈 提交于 2019-12-02 20:33:39
I have installed Oracle 10g xe from a deb file on linux, and then started to configure it using this terminal command sudo /etc/init.d/oracle-xe configure but after finishing configuration I forgot the password, so how can I reconfigure it again after reinstallation as now when I use the previous command I receive Oracle Database 10g Express Edition is already configured Thanks, Sacx Oracle creates a system account named oracle. To change password to that account just use passwd oracle if you forgot another password from DB then log in as oracle user and use sqlplus / as sysdba to change the

How to delete a user in Oracle 10 including all it's tablespace and datafiles

久未见 提交于 2019-12-02 19:30:21
When I give the command to drop a user i.e. DROP USER 'username' cascade, Does it deletes all the tablespace and datafiles used by that particular user. If not, what is the command to delete all the tablespace / datafiles / disk space that were used by that particular user. After dropping the user, you need to, for each related tablespace, take it offline and drop it. For example if you had a user named 'SAMPLE' and two tablespaces called 'SAMPLE' and 'SAMPLE_INDEX', then you'd need to do the following: DROP USER SAMPLE CASCADE; ALTER TABLESPACE SAMPLE OFFLINE; DROP TABLESPACE SAMPLE INCLUDING

How to check conditions and write text into text file oracle forms

夙愿已清 提交于 2019-12-02 19:27:34
问题 I am creating Procedure in Oracle Forms in which Check Validation data and insert data into table. Also check Validation data If condition true then write Some texts into text file and If condition is not true then write some texts into text file. Like: Validation No.1 : OK Validation No.2 : OK I created procedure successfully for "TRUE" Condition. Now I want If One Condition is True and 2nd Condition is False then write texts into text file. Like: Validation No.1 : OK Validation No.2 : ERROR

Allowing a users to select from a table

心已入冬 提交于 2019-12-02 18:22:56
问题 The emp table does exist for cis605 and I want to assign permissions to user. Any ideas to what I am doing wrong? SQL> grant select on emp to user; Grant succeeded. SQL> connect user Enter password: Connected. SQL> select * from emp; select * from emp * ERROR at line 1: ORA-00942: table or view does not exist I have also tried doing it differently SQL> connect cis605 Enter password: Connected. SQL> grant select on system.emp to chap7; grant select on system.emp to chap7 * ERROR at line 1: ORA

Not able to select a table even if having SELECT privilege

倖福魔咒の 提交于 2019-12-02 18:09:43
问题 I have two users, USER1 and USER2 . USER1 has privilege to create table and USER2 does not have this privilege. USER1 has created a table called EMPLOYEE and granted the select privilege on that table to USER2 : ====== Using USER1 credentials ======= 1) Create table- CREATE TABLE EMPLOYEE ( EMP_ID NUMBER, EMP_NAME VARCHAR2 (20 BYTE) ); 2) Grant permission to user2 GRANT SELECT ON EMPLOYEE TO USER2; ====== Using USER2 credentials ======= Now I want to access the EMPLOYEE table using USER2

ORA-28000: the account is locked error getting frequently

时光怂恿深爱的人放手 提交于 2019-12-02 17:52:50
I am getting the error : ORA-28000: the account is locked Is this a DB Issue? When I unlock user account using the command ALTER USER username ACCOUNT UNLOCK temporarily it will be OK. Then after some time the same account lock happens again. The database using is oracle XE Does anybody else have the same issue? Varun Jain One of the reasons of your problem could be the password policy you are using. And if there is no such policy of yours then check your settings for the password properties in the DEFAULT profile with the following query: SELECT resource_name, limit FROM dba_profiles WHERE

How to update empty string to oracle Clob

假如想象 提交于 2019-12-02 17:52:20
问题 I know it works by using SQL update activity set REFERENCE = EMPTY_CLOB() where id = ? But I cannot do like this, I cannot hard coded 'EMPTY_CLOB()' in SQL. I used the way like the following: String empty_string = ""; conn = getConnection(); pStmt = conn.prepareStatement("SELECT REFERENCE FROM activity WHERE ID = ? FOR UPDATE"); pStmt.setLong(1, 1); rset = pStmt.executeQuery(); Clob clob = null; while (rset.next()) { clob = rset.getClob(1); Writer writer = adapter.getCharacterOutputStream

How to use oracle check constraints to limit number of registration?

邮差的信 提交于 2019-12-02 17:13:04
问题 I've a user table with unique user_id. User can register using there id. Now I want to limit the max. registration per user using CHECK constraints. so I use this: .... CHECK(select count(user_id) from user where ... ...) But it's show subquery cannot use in check constraints. Can anyone tell me how can I add this condition? 回答1: Under certain conditions, you can enforce table restrictsion with materialized views : create table tq84_t ( user_id number, foo varchar2(10), constraint pk_tq84_t