Creating A Procedure In SQL Server

Mar 12, 2011

Recently decided to try using Oracle. Previously when creating a procedure in SQL server I would have done the following.

Create PROCEDURE GetInfo AS
SELECT InfoID, Name, Description
FROM GetInfo;

How can I write this same procedure in Oracle?

View 10 Replies


ADVERTISEMENT

Creating Trigger Through Procedure

Jul 24, 2009

I am trying to create trigger through Procedure due to following reasons-

1. The name of the column on which trigger will execute, is to be fetched dynamically.
2. The name of the column to be updated, is to be fetched dynamically.

Here is the sample code-

CREATE OR REPLACE PROCEDURE test2
IS
var VARCHAR2 (4000);
uname VARCHAR2 (30);
attribtask VARCHAR2 (100);
mapcol VARCHAR2 (100);
BEGIN
[code].........

On execution, the procedure throws the error of 'Insufficient privileges'. The 'var' seems to be the main culprit because the issue disappears if var is set to 'select * from dual'. Also, if i take the output (value of var) given by DBMS_output.put_line function and execute it explicitly, trigger gets created.

In addition- The procedure is (and being executed) within the same user/schema under which trigger is going to be created.

View 2 Replies View Related

SQL & PL/SQL :: Creating A View From Procedure

Mar 4, 2011

I have create a procedure as

create or replace procedure aa is
abc varchar2(1000);
begin
abc:='create or replace view abc_view as select * from abc';
execute immediate abc;
end;

When i try to execute the same as

BEGIN
aa;
END;

i got error as

ORA-01031: insufficient privileges
ORA-06512: at "EARS.AA", line 5
ORA-06512: at line 3

why i get this error. there is no problem in grants. the same create or replace view query works if i directly executes in sql.

View 8 Replies View Related

PL/SQL :: Getting Many Errors When Creating The Procedure

Jun 28, 2012

I am getting many errors when creating the below procedure.

alter procedure sp_compileinvalid as
Begin
Set lines 999;
Spool run_invalid.sql
select
[code].......

View 14 Replies View Related

SQL & PL/SQL :: Creating Procedure Which Will Process All The Cursors?

Apr 19, 2012

My requirement is like as follows,

declare
v1str varchar2(100):='select empno,ename from emp';
v2str varchar2(100):='select empno,ename,sal from emp';
type t_array is varray(2) of varchar2(100);

[Code]....

So my problem is while executing the different sql statements by passing it to the procedure,how can the procedure would behave dynamically.It must be able to process all the sql statements.

View 21 Replies View Related

PL/SQL :: Creating A Procedure Using Explicit Cursor?

Nov 19, 2013

I am writing this procedure with a explicit cursors defined in it.  However when i compile the procedure i get this error: Error(39,1): PL/SQL: SQL Statement ignored Error(39,1):PLS-00394: wrong number of values in the INTO list of a FETCH statement .

create or replace PROCEDURE PRO_ICMISd_customer_no BB_PM.customer_no%type;d_pr_code_bbl BB_PM.pr_code_bbl%type;d_pr_code_pmm BB_PM.pr_code_pmm%type;d_subdept_desc PM.subdept_desc%type;d_class_desc PM.class_desc%type;d_cat_desc PM.cat_desc%type;d_subcat_desc PM.subcat_desc%type;d_brand_name PM.brand_name%type;d_product_desc PM.product_desc%type;d_unit_price_bbl PM.unit_price%type; e_customer_no BB_PM.customer_no%type;e_pr_code_bbl BB_PM.pr_code_bbl%type;e_pr_code_pmm BB_PM.pr_code_pmm%type;e_subdept_desc PM.subdept_desc%type;e_class_desc PM.class_desc%type;e_cat_desc PM.cat_desc%type;e_subcat_desc PM.subcat_desc%type;e_brand_name PM.brand_name%type;e_product_desc

[code]....

View 17 Replies View Related

SQL & PL/SQL :: Check If Object Exist Or Not While Creating Procedure?

Mar 5, 2012

I have to create a stored procedure having some 10 cursors and i have to display the data's fetched by select statement in cursors using dbms_output.put_line().

for ex:
-------
CREATE OR REPLACE PROCEDURE PROC AS
CURSOR C1 AS SELECT * FROM EMP;
BEGIN
FOR R IN C1
LOOP

[code].....

My question is while creating procedure i want to check if the object exist in database or not.

If EXIST
NO PROBLEM MY CODE CREATE THE PROC AND EXECUTED FINE
IF NOT EXIST

I don't want an exception to be thrown stating "OBJECT DOES NOT EXIST" I wanted PL/SQL engine not to execute the particular select statement itself and continue executing other select statements.

The reason why have such kind of wierd requirement is my program displays all the CEMLI objects in any 11.5.10 instance. I don't know whether they have installed discoverer or not. if they installed it no problem else my program have to eliminate.EXECUTE IMMEDIATE, REF CURSOR becoz i tried it and works fine.but not able to wrap in WRAPPER UTILITY 8.0 versions.

View 14 Replies View Related

Client Tools :: Creating Procedure Using SQL Developer?

Jan 23, 2012

I am trying to get my stored procedures together again after many years of working on MS SQL server. I'm alternating between using SQL-Plus and Oracle SQL Developer for Mac. In SQL Developer - which I like to use - I keep getting errors at the point where the END command for the package header occurs and the create command for the package body starts.

I've found that if I run the following in SQL-Plus I'm OK but if I try it from SQL Developer I get a compile error such as following or else an error telling me that it expects function, or pragma or something to that effect:

Error(8,1):PLS-00103:Encountered the symbol "/"

The code is as follows:
--------------------------------------
CREATE OR REPLACE PACKAGE MACR_SAMPLE_PROC_4 AS
PROCEDURE sampleproc_4(
pParam1 in integer,
pParam2 out varchar2);
END MACR_SAMPLE_PROC_4;

[code].....

View 9 Replies View Related

SQL & PL/SQL :: Usage Of Loop - Creating A Procedure With 4 Input Parameters

Jun 6, 2012

I have a Table with 4 columns and I am creating a procedure with 4 input parameters and inserting into the table as 4 parameters and how to use loop to insert multiple records.The data to be taken from excel.please suggest how to use the loop to insert multiple records.

create or replace procedure PRC_add_data(
P_Emp_No varchar2,
P_Member_Name varchar2,
P_IDvarchar2,
P_UHID varchar2
)
is
BEGIN
INSERT INTO UploadData (Emp_No,Member_Name,ID,UHID) values (P_Emp_No,P_Member_Name,P_ID,P_UHID)
END;
/

View 6 Replies View Related

Application Express :: Creating Procedure Using Database Package

Oct 23, 2012

I have created a procedure within a database package, but when I want to create a form based on procedure but I can't call it. I think that I have to use prefix, I am a beginner in database and I don't know how to do this.

View 4 Replies View Related

SQL & PL/SQL :: Creating Store Procedure That Will Accept A Username From A Flat File?

Apr 8, 2012

I'm trying to create a store procedure that will accept a username from a flat file but i don't know how to do read file into store procedure.

Below is a sample store procedure by itself i created to add user which created okay but when i execute I got the error displayed below.

create or replace procedure addUsers(userNam in varchar2)
is
begin
EXECUTE IMMEDIATE 'CREATE USER'||userNam||'IDENTIFIED BY "pass1234" DEFAULT TABLESPACE USERS'||'QUOTA "1M" ON USERS'||
'PASSWORD EXPIRE';
end addUsers;
/

[code].....

View 21 Replies View Related

Creating And Dropping Global Temp Tables Inside A Single Procedure

Aug 20, 2010

I am writing a procedure that will be called from a java wrapper.

The procedure do a lot of data manipulations and in between i am creating global temp table and saving the data into it for each request thats given as a parameter to the procedure. After all the processing i have to write the data from this global temp table into a physical table and atlast drop the temp table.

Create or replace proc_name ()

update table........

delete from ..........

CREATE GLOBAL TEMPORARY TABLE TSAAG
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50)
)

insert into............

drop table TSAAG;

End;

creating a global temp table inside a procedure is expensive...

Do we have anything like creating table before and calling the instanse of it in procedure.

Do we have any alternatives to this..

View 3 Replies View Related

Server Administration :: While Creating Index ORA-00603 / ORACLE Server Session Terminated By Fatal Error

Jul 26, 2010

While creating the index we are getting the error "ORA-00603: ORACLE server session terminated by fatal error".

We have the space in tablespaces and also in the file systesm.

View 13 Replies View Related

Server Administration :: Creating Physical Standby Server?

Feb 10, 2010

I am currently running my production database server on win 2003 with oracle9i, I want to create a physical standby server, so I had created new server with same configuration. Need command to apply these datafiles and archives which are generating everyday in my primary database server.

View 1 Replies View Related

Forms :: Creating A Procedure Oracle Forms And Database

Nov 3, 2011

I am creating a procedure oracle forms and database Which one is fires first ..If suppose i need data base fires first...

View 3 Replies View Related

Server Administration :: ORA-01101 While Creating DB?

Oct 18, 2011

I have a fresh server with no databases. The processes is to create database using a custom script cr_db, this invokes dbca saliently.

While creating a new database i faced the below error: -

Cleaning up failed steps
DBCA_PROGRESS : 4%
Creating and starting Oracle instance
DBCA_PROGRESS : 6%
DBCA_PROGRESS : 7%
DBCA_PROGRESS : 8%
ORA-01501: CREATE DATABASE failed
ORA-01101: database being created currently mounted by some other instance
ORA-01501: CREATE DATABASE failed
ORA-01101: database being created currently mounted by some other instance

DBCA_PROGRESS : 100%

There are no databases in the server : -

[oracle@lxx0019:/prd/dvp/ora/app/oracle/admin/LDD/diag/rdbms/ldd/LDD/trace]# ps -ef | grep pmon oracle 27784 10729 0 10:52 pts/3 00:00:00 grep pmon

View 2 Replies View Related

Ora-12560 When Creating Database In 2008 Server

Aug 14, 2010

i have win 2008 server and oracle 10g when im try to install oracle it terminate successfully but when insall domain controller in windows , oracle dont terminate the installation and break in creating data base (2%) and return the error message : ora-12560 tns adaptator protocol error

View 1 Replies View Related

Server Administration :: Creating Tablespace In Raw Partition?

Aug 17, 2012

i want to create tablespace in raw partion on windows.I have added a hard disk and added extended partition to it. Then created 4 logical partitions of 256 MB with diskpart.exe.I have assigned a drive letter to one of them as X:

However, I am having trouble in creating tablespace on it. I referred to [URL]... I get following error,

C:UsersAdministrator>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 17 15:32:17 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: SYSTEM
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing opti

SQL> create tablespace exampletb datafile '\.X:accounting_1' size 100;
create tablespace exampletb datafile '\.X:accounting_1' size 100

ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
SQL> create tablespace exampletb datafile '\.X:accounting_1' size 502;
create tablespace exampletb datafile '\.X:accounting_1' size 502

[code]...

View 1 Replies View Related

Server Administration :: Creating New Database In Oracle?

Nov 10, 2010

how to create a new database in oracle??

View 2 Replies View Related

Server Administration :: Error In Creating Database

Feb 17, 2010

I have created a database in Oracle10g which is working fine. Now when I try to create another the system gives the following error.

ORA-12560: TNS protocol adapter error.

View 8 Replies View Related

Server Utilities :: SQL Loader Not Creating Bad File?

Nov 11, 2011

My sql loader is returning a code 2 but not creating a bad file for the rejected records. also logs look good.

View 14 Replies View Related

Server Administration :: ORA-01078 While Creating Database Using DBCA?

May 10, 2011

I installed Oracle 11gR2 withouth creating a database in my laptop. Later when I tried to crete the database using DBCA it shows error ORA-01078:failure in processing system parameters.I clicked on ignore error, then shows the error ORA-01034: Oracle not available.

View 4 Replies View Related

Server Administration :: Things Need To Be Considered While Creating Tablespace

Jan 22, 2013

I'm new at administrating a database (10gR2 on RHEL5).

1)What are the things need to be considered while creating tablespace?

2)What factors need to be considered when adding space to a tablespace?

View 3 Replies View Related

Server Administration :: Creating Spfile From Pfile Error

Jun 25, 2011

whenever i tried to create spfile from pfile i got this error...oracle not available and shared memory realme does not exist.

View 10 Replies View Related

Server Administration :: ORA-01092 - Manually Creating A Database

Mar 6, 2011

I've been working to create (via script) this database for the last 2 days.. everytime I startup in nomount mode (as sysdba), it displays this error:

$ echo $ORACLE_SID
elams
$
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Mar 7 09:41:26 2011
[code]....

View 4 Replies View Related

SQL & PL/SQL :: Creating Text File On Specific Path Of Database Server?

Nov 28, 2012

using pl/sql code i am creating text file on specific path of database server. i need to compress this file .how to compress the text file using pl/sql?

View 1 Replies View Related

Server Utilities :: Creating SQL Loader Ctl File With Over 1000 Columns?

Dec 3, 2010

Next week I will be getting an input file which will contain over 1000 data columns to be loaded into ORACLE. It's about 6,400 characters in length.

My question is...has ever created a huge ctl file like this to be used for SQLLoader, using so many columns? I will be sending certain columns(data) to certain tables, so it's not just going into 1. It will be about 6 tables.

View 39 Replies View Related

Server Administration :: ORA-03114 Error While Creating Database Using DBCA

May 16, 2013

I am getting a ORA-03114 (not connected to Oracle) error when I am creating a DB using DBCA. Here are the steps that I do:

1) Log onto the server remotely, using Exceed Query
2) Connect as the oracle user (Oracle)
3) set ORACLE_HOME, PATH
4) Run DBCA, give parameters

At around 12% and again at 19%, I get the error (see screenshot). I also tried to generate the scripts and run them remotely, and the steps run successfully upto & including the step " startup nomount pfile="/oracle/admin/<dbname>/scripts/init.ora"; ". After that, when I try to run the script specified in rmanRestoreDatafiles.sql from SQL> prompt, the error appears, and connection to ORACLE is lost.

Googling the error shows that it is a connectivilty issue, and Oracle says that it is usually caused by user scripts. But I am not running any user-created scripts as part of the DBCA process. Somehow, the instance is timing out immediately after doing the "startup nomount".

View 4 Replies View Related

Server Administration :: Creating ASM Instance Using DBCA / ORA-01012 Not Logged On

Jul 14, 2010

create an ASM (Automatic Storage Management) instance using dbca. At first try I mistakenly skipped the part where I click on ASM Parameters to add /dev/raw/raw* as my asm_diskstring so it created an ASM instance. When I get to the next page ASM Disk Groups, I selected Create New and I did not have the desired display, because of the step I missed.

I went back to do some cleaning up as follows:

1) Edit the oratab file to remove the ASM entry

2) backed up these files by renaming to old-<filename>
old-ab_+ASM.dat
old-hc_+ASM.dat
old-lk+ASM
old-orapw+ASM
old-spfile2+ASM.ora

3) killed the following processes (kill -9):

oracle 1590 1 0 22:52 ? 00:00:00 asm_pmon_+ASM
oracle 1592 1 0 22:52 ? 00:00:00 asm_psp0_+ASM
oracle 1594 1 0 22:52 ? 00:00:00 asm_mman_+ASM
oracle 1596 1 0 22:52 ? 00:00:00 asm_dbw0_+ASM
oracle 1598 1 0 22:52 ? 00:00:00 asm_lgwr_+ASM

[code]....

4) Run the following as root:

/u01/app/oracle/product/10.2.0/db_1/bin/localconfig delete

5) Restarted the database

Now when I try to go through the steps to create an ASM instance, at the point after I enter my ASM Parameters, I get the following prompt:

"DBCA will now create and start the ASM instance. After the ASM instance is started you can create the diskgroups to be used as storage for your database."

I click OK. Then I get the error message:

ORA-01012 not logged on

View 12 Replies View Related

Server Administration :: Creating / Running Jobs In Oracle 9i For Solaris

Sep 5, 2005

How to

1) to define a job in oracle9i for solaris
2) to schedule this job

Remember i have prior experience deploying jobs at windows platform but when i try it on (9i for ) solaris, the script does not work as it does not accept a submit job request.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved