oracle11g

DBMS_SCHEDULER.DROP_JOB only if exists

佐手、 提交于 2019-12-21 03:34:14
问题 I have a sql script that I must run after I import a dump. among other things the script does, it does the following: BEGIN --remove program SYS.DBMS_SCHEDULER.DROP_PROGRAM(program_name=>'STATISTICS_COLUMNS_PROG',FORCE=>TRUE); --remove job SYS.DBMS_SCHEDULER.DROP_JOB (job_name => 'STATISTICS_COLUMNS_JOB'); END; Somtimes the job was already dropped in the original schema, the dump comes without the job and the script fails: ERROR at line 1: ORA-27475: "DMP_6633.STATISTICS_SET_COLUMNS_JOB" must

How to find schema name in Oracle ? when you are connected in sql session using read only user

狂风中的少年 提交于 2019-12-21 03:33:22
问题 I am connected to a oracle database with a read only user and i used service name while Setting up connection in sql developer hence i dont know SID ( schema ). How can i find out schema name which i am connected to ? I am looking for this because i want to generate ER diagram and in that process at one step it asks to select schema. When i tried to select my user name , i dint get any tables as i guess all tables are mapped with schema user. Edit: I got my answer partially by the below sql

Default Values to Stored Procedure in Oracle

风格不统一 提交于 2019-12-21 03:14:04
问题 I have a stored procedure as follows. CREATE OR REPLACE PROCEDURE TEST( X IN VARCHAR2 DEFAULT 'P', Y IN NUMBER DEFAULT 1) AS BEGIN DBMS_OUTPUT.PUT_LINE('X'|| X||'--'||'Y'||Y); END; When I execute the above procedure EXEC TEST(NULL,NULL); It will print X--Y . The input parameters are not defaulting to the specified values in the procedure signature when input parameters are null . What is the use of default values then? What if we pass a null value as input and we want to replace a null value

Inner Join Three Tables

情到浓时终转凉″ 提交于 2019-12-21 02:37:15
问题 I am working in Oracle APEX.i want to make a report from three tables through INNER JOIN .The Tables are as Fallows. PATIENT (Par_Id(Pk),Pat_Name,Pat_Gender) HISTORY (His_Id(Pk),Pat_id(Fk),Treated_By) and Treatment ( Treat_Id, His_id(Fk),Pat_id(Fk) ,Treat_Type ,Charges) I want to display all the columns in Report mentioned in the above three Tables. Thanks. 回答1: You should always specify the columns to return, especially as the tables contain identical column names SELECT p.Par_Id, p.Pat_Name

What username & password should be entered when connecting to SQL*Plus after installing Oracle 11g?

孤街醉人 提交于 2019-12-21 01:39:16
问题 I have installed Oracle 11g on Windows 7 When I start sqlplus, it ask me for a username and password Can anybody tell me what username needs to be inserted and when I try to type in any password, it doesn't allow me to type a single letter. Is there a reason why? 回答1: If you've forgotten the password for any user then you can reset by logging in as SYS: sqlplus / as sysdba And then: alter user <username> identified by <password>; If you've forgotten which users you have then you can run:

Problems creating a trigger in Oracle 11g

自闭症网瘾萝莉.ら 提交于 2019-12-20 17:29:29
问题 I get a weird error while trying to create a trigger in my Oracle 11g database using SQL Developer. Here is what I did: My table: CREATE TABLE COUNTRY_CODE( ID NUMBER(19,0) PRIMARY KEY NOT NULL, Code VARCHAR2(2) NOT NULL, Description VARCHAR2(50), created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, created_by VARCHAR2(40) DEFAULT USER, last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP, last_updated_by VARCHAR2(40) DEFAULT USER, archived CHAR(1) DEFAULT '0' NOT NULL ); The Sequence: CREATE SEQUENCE

Getting location of file tnsnames.ora by code

不想你离开。 提交于 2019-12-20 15:28:44
问题 How can I get the location of the tnsnames.ora file by code, in a machine with the Oracle client installed? Is there a windows registry key indicating the location of this file? 回答1: Some years ago I had the same problem. Back then I had to support Oracle 9 and 10 so the code only takes care of those versions, but maybe it saves you from some research. The idea is to: search the registry to determine the oracle client version try to find the ORACLE_HOME finally get the tnsnames from HOME

Performing an Oracle Transaction using C# and ODP.NET

放肆的年华 提交于 2019-12-20 12:29:21
问题 I'm confused. On the face of it, performing a transaction in C# seems simple. From here: http://docs.oracle.com/cd/B19306_01/win.102/b14307/OracleTransactionClass.htm string constr = "User Id=scott;Password=tiger;Data Source=oracle"; OracleConnection con = new OracleConnection(constr); con.Open(); OracleCommand cmd = con.CreateCommand(); cmd.CommandText = "SELECT COUNT(*) FROM MyTable"; // Start a transaction OracleTransaction txn = con.BeginTransaction( IsolationLevel.ReadCommitted); try { /

Oracle SQL query for Date format

梦想的初衷 提交于 2019-12-20 12:09:02
问题 I always get confused with date format in ORACLE SQL query and spend minutes together to google, Can someone explain me the simplest way to tackle when we have different format of date in database table ? for instance i have a date column as ES_DATE, holds data as 27-APR-12 11.52.48.294030000 AM of Data type TIMESTAMP(6) WITH LOCAL TIME ZONE. I wrote simple select query to fetch data for that particular day and it returns me nothing. Can someone explain me ? select * from table where es_date

How to create a small and simple database using Oracle 11 g and SQL Developer?

泪湿孤枕 提交于 2019-12-20 12:06:53
问题 How to create a small and simple database using Oracle 11 g and SQL Developer ? I am seeing too many errors and I cannot find any way to make a simple database. For example create database company; Caused the following error: Error starting at line 1 in command: create database company Error at Command Line:1 Column:0 Error report: SQL Error: ORA-01501: CREATE DATABASE failed ORA-01100: database already mounted 01501. 00000 - "CREATE DATABASE failed" *Cause: An error occurred during create