Embeded SQL Statment VS Store procedure
On J2ee tecknology, what is the better method of usind data services.
raping all sql statment in the store procedure or embeded all sql statment in EJB.
thanks
null
Hi,
This issue looks similar to the the issue described in:
Re: Exception in reader for ODP.NET 11.1.0.6.2 same work fine in older version
Note that Bug 9792727 was filed to track the issue described in the above link.
Regards,
-Naveen
Similar Messages
-
How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000
Post Author: ltkin
CA Forum: WebIntelligence Reporting
Hi,
How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000 ?
Regards,Hi ltkin,
Unfortunately, it is not possible in Xir2 to create Webi reports from stored procedures.
Webi reports can only be created from Universe. So in Business Objects XIR3 we can create a special universe that enables Web Intelligence user's to access stored procedures residing in the database. This is the only way that Web Intelligence user's can access stored procedures.
Please let me know if the above information helps.
Regards,
Pavan -
Calling stored procedure from embedded sql
I'm trying to call a stored procedure from embedded sql. I'm following the examples located in
http://download.oracle.com/docs/cd/B19306_01/appdev.102/a96109/pco06pls.htm#i9641
I have the following section in my .pco file before precompiling.
exec sql execute
begin
docs.grant_access_to_all_categories(:p_sam_id);
end;
end-exec.
When running procob on the file with the above code I get the following error.
Error at line 225, column 13 in file pco\docs_stored_procedures.pco
exec sql execute
............1
PCB-S-00576, PLS-201: identifier 'DOCS.GRANT_ACCESS_TO_ALL_CATEGORIES' must be d
eclared
Error at line 225, column 13 in file pco\docs_stored_procedures.pco
exec sql execute
............1
PCB-S-00576, PLS-0: Statement ignored
Any ideas on what I am doing wrong on calling this stored procedure.I get the same error when trying to precompile sample11.pco from the demo directory in the oracle client software.
Error at line 70, column 12 in file sample11.pco
EXEC SQL EXECUTE
...........1
PCB-S-00576, PLS-201: identifier 'EMP_DEMO_PKG.OPEN_CUR' must be declared
Error at line 70, column 12 in file sample11.pco
EXEC SQL EXECUTE
...........1
PCB-S-00576, PLS-0: Statement ignored -
Decrypt the encrypted store procedure through the T-SQL programming in SQL Server 2005
HI ,
I have a encrypted store procedure in my production server .Right now I do not have the script now I want do some modification.
Please any one can help me to decrypt the store procedure it will be a great help for me.
For any suggestion thanks
in advance.
" Education is the beginning of transformation. Dedicate yourself to daily learning via Blogs/Forums/books and coaching "
Click here to read my blogI have modified Jon's post so it also supports functions correctly, jon's version gave a syntax error on functions because the dummy func sql was invalid
1. Connect using "admin:server\instance" instead of "server\instance" (enable dac if you havent already, its an sp_reconfigure command)
2. create the below proc
3. exec SqlDecryptor 'dbo', 'function_or_stored_proc_name'
ALTER -- CREATE
proc SqlDecryptor (@objschemaname nvarchar(255), @objname nvarchar(255))
AS
DECLARE @objid INT,@objtype NVARCHAR(50),@objtypicalstm NVARCHAR(4000),@objencrypted BIT
SELECT TOP 1 @objid=o,@objname = n,@objtype = t,@objtypicalstm=s,@objencrypted = (SELECT ([encrypted]) FROM syscomments WHERE [id] = x.o and colid = 1)
FROM
SELECT object_id o, name n,
CASE WHEN [type] = 'P' THEN N'PROCEDURE'
WHEN [type] = 'V' THEN 'VIEW'
WHEN [type] IN ('FN','TF','IF') THEN N'FUNCTION'
ELSE [type]
END t,
CASE WHEN [type] = 'P' THEN N'WITH ENCRYPTION AS'
WHEN [type] = 'V' THEN N'WITH ENCRYPTION AS SELECT 123 ABC'
WHEN [type] IN ('FN','TF','IF') THEN N' () RETURNS INT WITH ENCRYPTION AS BEGIN RETURN 1 END'
ELSE [type]
END s
FROM sys.all_objects WHERE [type] NOT IN ('S','U','PK','F','D','SQ','IT','X','PC','FS','AF')
AND name = @objname AND (SCHEMA_NAME([schema_id]) = COALESCE(@objschemaname,'dbo'))
--UNION ALL SELECT object_id,name,'TRIGGER',N'ON ALL SERVER WITH ENCRYPTION FOR DDL_LOGIN_EVENTS AS SELECT 1' FROM sys.server_triggers WHERE name = @objname
--UNION ALL SELECT object_id,name,'TRIGGER',N'ON DATABASE WITH ENCRYPTION FOR CREATE_TABLE AS SELECT 1' FROM sys.triggers WHERE name = @objname
) x
--SELECT @objid,@objname,@objtype,@objtypicalstm,@objencrypted
SET NOCOUNT ON
IF @objencrypted <> 0
BEGIN
IF EXISTS
SELECT * FROM sys.dm_exec_connections ec JOIN sys.endpoints e
on (ec.[endpoint_id]=e.[endpoint_id])
WHERE e.[name]='Dedicated Admin Connection'
AND ec.[session_id] = @@SPID
BEGIN
DECLARE @ChunkNumber INT,@ChunkPiece NVARCHAR(MAX),@CompareChunksAtPosition INT,@DummyChunk NVARCHAR(MAX),@DummyObject VARBINARY(MAX),@EncryptedChunk NVARCHAR(MAX),@EncryptedObject VARBINARY(MAX),@p INT,@p1 NVARCHAR(MAX),@p2 NVARCHAR(MAX),@QueryForDummyObject NVARCHAR(MAX),@ReplacementText NVARCHAR(4000)
SELECT @EncryptedObject = [imageval] FROM [sys].[sysobjvalues] WHERE [objid] = @objid AND [valclass] = 1
BEGIN TRANSACTION
SET @p = 1
SET @p1= N'ALTER'+SPACE(1)+@objtype+SPACE(1)+ISNULL((@objschemaname+'.'),'')+@objname +SPACE(1)+@objtypicalstm;
SET @p1=@p1+REPLICATE('-',4000-LEN(@p1))
SET @p2 = REPLICATE('-',8000)
SET @QueryForDummyObject = N'EXEC(@p1'
WHILE @p <=CEILING(DATALENGTH(@EncryptedObject) / 8000.0)
BEGIN
SET @QueryForDummyObject=@QueryForDummyObject+N'+@f'
SET @p =@p +1
END
SET @QueryForDummyObject=@QueryForDummyObject+')'
EXEC sp_executesql @QueryForDummyObject,N'@p1 NVARCHAR(4000),@f VARCHAR(8000)',@p1=@p1,@f=@p2
SET @DummyObject=(SELECT [imageval] FROM [sys].[sysobjvalues] WHERE [objid] = @objid and [valclass] = 1)
ROLLBACK TRANSACTION
SET @ChunkNumber=1
WHILE @ChunkNumber<=CEILING(DATALENGTH(@EncryptedObject) / 8000.0)
BEGIN
SELECT @EncryptedChunk = SUBSTRING(@EncryptedObject, (@ChunkNumber - 1) * 8000 + 1, 8000)
SELECT @DummyChunk = SUBSTRING(@DummyObject, (@ChunkNumber - 1) * 8000 + 1, 8000)
IF @ChunkNumber=1
BEGIN
SET @ReplacementText=N'CREATE'+SPACE(1)+@objtype+SPACE(1)+ISNULL((@objschemaname+'.'),'')+@objname +SPACE(1)+@objtypicalstm+REPLICATE('-',4000)
END
ELSE
BEGIN
SET @ReplacementText=REPLICATE('-', 4000)
END
SET @ChunkPiece = REPLICATE(N'A', (DATALENGTH(@EncryptedChunk) / 2))
SET @CompareChunksAtPosition=1
WHILE @CompareChunksAtPosition<=DATALENGTH(@EncryptedChunk)/2
BEGIN
SET @ChunkPiece = STUFF(@ChunkPiece, @CompareChunksAtPosition, 1, NCHAR(UNICODE(SUBSTRING(@EncryptedChunk, @CompareChunksAtPosition, 1)) ^ (UNICODE(SUBSTRING(@ReplacementText, @CompareChunksAtPosition, 1)) ^ UNICODE(SUBSTRING(@DummyChunk, @CompareChunksAtPosition, 1)))))
SET @CompareChunksAtPosition=@CompareChunksAtPosition+1
END
PRINT @ChunkPiece
SET @ChunkNumber=@ChunkNumber+1
END
END
ELSE
BEGIN
PRINT 'Use a DAC Connection'
END
END
ELSE
BEGIN
PRINT 'Object not encrypted or not found'
END
SET QUOTED_IDENTIFIER OFF
GO -
How to write a store procedure under SQL Server 2008
Hi Folks,
Kindly help me step by step how to create a simple store procedure with help of sql server 2008 r2 for Crystal report.
I know how to work by using Universe but not SQL Server. Kindly help me how to hard code by using sql.
Thanks in adv.
ReddyFor the actual syntax for programming the stored proc, you'll need to work with someone (or a website) who knows T-SQL.
The cursor that gets returned from the stored proc must be an "in out" parameter for the stored proc. For SQL Server I usually define a record type that includes the fields that will be returned and then return a set of records of that type. Again, check with someone who is familiar with T-SQL for more information about how to do this.
-Dell -
How to run a SQL server store procedure from Apex (oracle)?
Our application needs to call a store procedure in the SQLserver database. The sotre procedure works fine in the SQL server side. However, when I tried to call the store procedure in TOAD as:
exec my_store_procedure(para1, para2);
I kept getting the error message:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'my_store_procedure'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I have searched online but couldn't find the solution. This is an emergency, so prompt reply is Highly Appreciated!
LucHow is Oracle connecting to the SQL Server?
With the Transparent Gateway or Generic Connectivity?
I don't think that Generic Connectivity supports stored procedures.
The documentation for Heterogeneous Connectivity is here:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14232/toc.htm
You'd probably get better answers from the Heterogeneous Connectivity forum:
Heterogeneous Connectivity -
What is the data dictionary that stores the SQL text of stored procedures?
I am handling both Oracle 8i on IBM AIX 5L and Oracle9i on SUN Soliars 8 /9.
What is/are the data dictionary tables, or v$ views that store the SQL text of stored procedured and triggers?
Thank you in advance!If the procedures are not wrapped, you can view them in the dba/all/user_source view. Trigger bodies can be seen in dba/all/user_triggers view.
Message was edited by:
Daniel Fink -
Call Store Procedure in SQL Server
How can I call an Oracle Store Procedure in a SQL Server procedure?
Make sure you're calling the stored procedure with the same parameters at the same database. If that's not the case then send the procedure body and how you are calling it from code and DB .
"If there's nothing wrong with me, maybe there's something wrong with the universe!" -
SQL Server Store Procedure, selecting rows from multiple tables
i have got a store procedure that is pulling data from one table, now i have got the same data collected in a different table,
as the IDs are different i cannot put all data from the second table into the first one. so now i have to have two select statements in one store procedure. Although the corresponding data is same but the field names in both table are different. for instance
BRIEF_TITLE would be briefTitle in the second table. how can i merge the data from two different tables into one. the result is bonded to ASP.net grid view control.>> I have a store procedure that is pulling data from one table, now I have got the same data collected in a different table, as the IDs are different I cannot put all data from the second table into the first one. <<
This is redundancy. The idea of databases even before RDBMS, was to remove redundancy. Oh, columns are not fields. These are basic concepts.
>> so now I have to have two select statements in one store procedure. Although the corresponding data is same but the field [sic] names in both table are different.<<
NO! Where is your data dictionary that assures data elements have one and only one name everywhere in the enterprise! You are is serious trouble here. The data element names should be universal and used everywhere with the same casing, so that case sensitive
standards will work.
>> for instance BRIEF_TITLE would be briefTitle in the second table.<<
The quick kludge is a VIEW with the ISO-11179 names over the camelCase crap
The moron who did the second table does not know ISO-11179 Standards and missed the research that showed us that camelCase does not work. Your eye is trained to jump to an Uppercase letter since it is the start of a semantic unit (proper name, sentence, paragraph,
emphasis, etc). When we researched this stuff at AIRMICS, this could add 8-12% to the time to maintain code in large systems. Your eyes twitch!
You really need to get your act together with a good text editor/ pretty printer tools. Get a copy of my SQL Programming Style and adapt it to those tools.
>> The result is bonded to ASP.net grid view control. <<
We are the SQL guys; we do not are about the presentation layers :)
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
how to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server?
Does any body can tell me about this?
thanks
[email protected]Hi
Did you succeed to execute the procedure?
How ?
Thanks
Shimon Zerbib -
Deploy EAR file to OC4J from PL/SQL Store Procedure
Hi
Can you deploy an EAR File from PL/SQL Store Procedure?
are there any API'S to achieve that?
Thanks.Customer has an IAS 10.1.3 Environment with multiple OC4J's for different projects.
We would like to allow each Project Team to be able to perform deployment on their own.
Problem is, that we want to be able to control which OC4J Container each project team can deploy to and restrict them from creating into other containers.
Although IAS 10.1.3 does allow you to define different users and groups, it doesnt allow you to restrict a user/group into one specific OC4J.
This is a big problem for customer and in the quest of searching some Creative Solutions, we wanted to try and create a simple Web UI (i.e, in APEX) that will allow customer to
upload new EAR (or WAR) file and it will deploy it to their container automatically.
to achieve this, we need to find (easy) way to deploy files from PL/SQL.
we can always use external pl/sql procedure that run a Shell Script which does this,
but customer is searching for a more "direct" way to do this.
any suggestions on this issue? -
Getting a DataReader by stored procedure vs. SQL statment (Performance)
Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39 -
For loop to iterate through temp table in store procedure in pl/sql
Hi,
how to create For loop to iterate through the temporary table in the store procedure?Neha RK wrote:
hi,
its not working , i need to check each record of table and do some task using if else loop inside that for..
if not possible to loop each row of table using for then how to use while loop.
please helpWhat's not working? We haven't got psychic powers so we can't see the code you say isn't working.
Please provide more information like create table statements, insert statements with test data, the code you've tried
and the output you are expecting from the input data.
Read {message:id=9360002} and follow the advice there. -
File Ownership while executing sql script from stored procedure
We have a test_command.sql script which is spooling the result into a file. From database we have one Store Procedure(run_sql) which is
calling and executing the .sql script.
When we are calling the sql script directly from the database, i e SQL > @/dccops/test_command.sql it is creating the
file under the Ownership of OS user which is connected to the system.
The problem we are facing is when we are executing the stored procedure i e exec run_sql(), the file is creating under
Oracle User.
Could u please suggest me a solution inorder to create the output file under the user who is logged to the OS.First of all, your usage of IM speak is NOT appreciated. Please do not address anyone as if they were a 12-year old.
'Our Applcation is in C. So we have to call the procedure to run the sql script.'
This is just utter nonsense!
Oracle has Pro*C which allows Embedded SQL in C. There is also OCI (Oracle Call Interface) to call Oracle directly in C, and there is OCCI, to do the same in C++.
Apart from that, Oracle has Ole DB for Windows platforms, to allow for a .NET compatible interface to Oracle.
There is NO NEED AT ALL to call PL/SQL to run a SQL script.
Sybrand Bakker
Senior Oracle DBA -
Can't execute Sybase store procedure
Hi All,
I'm trying to execute sybase store procedure, but somehow the procedure not executing. if any body what's the problem? I'm using JBoss server
Code:
public void deleteRigMapSP(String pMappingID, String rigid, String date,String pPhysicalDel, String database) throws DataAccessException {
GregorianCalendar val = new GregorianCalendar();
DateFormatter dateform = new DateFormatter();
String deletiondate = dateform.convertGregorianToString(val);
query = new StringBuffer("EXECUTE spRR_STAT_DeleteMapping ");
query.append("'"+pMappingID + "',");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append("'"+deletiondate + "',");
query.append(pPhysicalDel);
System.out.println("query: "+query);
try {
getDBConnection(ServiceLocator.getInstance().getDataSource(database));
CallableStatement cs = dbConnection.prepareCall(query.toString());
if (cs.execute()) {
System.out.println("deleted");
} else {
System.out.println("not deleted");
When I try to execute the method it's run fine, but it not executing the procedure.
Any help will be greately appreciated.How do you know it's not executing? Maybe you're in manual transaction mode and you're not committing the transaction before you close the connection and it gets rolled back.
And why on earth are you using CallableStatement if you're embedding the parameters into the SQL query rather than using placeholders and the setXXX() methods?
Alin.
Maybe you are looking for
-
Hi at all, I extrakted initial data from source system and get a warning "No data in source system". I checked the system and it is ok. Plz help me
-
How do I allow guest access on a DCHP server?
I am fumbling through switching out a Windows 2003 DCHP server for a OSX DCHP Server. One of the settings I am missing is allowing visitors to the network to plug into our network and connect to the internet and maybe a printer. I don't need them to
-
Printing problem for picking list
Hi friends, Whenever we print the picking list of material with batch number. the printing job will bring a extra page with basic form information . it's kind of wasting the paper since the extra page doen not contain any specific picking information
-
We are in a process of selecting an ETL tool for our database. What criteria we should consider. We have several relation data sources (Oracle, sql server, mySql), flat files, SAP and other interfcases. If any one have done this type of evaluation, a
-
Porque compré la aplicación a través de mi tarjeta de crédito no tenían
porque compré la aplicación a través de mi tarjeta de crédito no tenían