stored-procedures

Call data-specific stored procedure from Oracle procedure

I have a situation where I have an Oracle procedure that is being called from at least 3 or 4 different places. I need to be able to be able to call custom-code depending on some data. The custom-code is customer-specific - so, customer A might want to do A-B-C where customer B might want to do 6-7-8 and customer C doesn't need to do a...

How to map inner object using Hibernate/JPA without xml/annotation?

We have an object, A, which contains another object, B. We have Hibernate calling a stored procedure to query the data and populate instances of A. We're using the @NamedNativeQuery annotation with teh resultClass property set to A.class. This works great except that the instances of B are loaded lazily, as if Hibernate can't figure o...

Setting query timeout on a stored procedure in SQL Server 2005

Does anyone know how to set the timeout on a stored procedure? Found some examples on the NET, e.g sp_configure 'remote Query Timeout', 5, but this did not work. Also found some commands "DBPROP_COMMANDTIMEOUT" and "DBPROP_GENERALTIMEOUT" but i don't know if they are the right ones to use and if they are, how to use them in my transact-S...

Type safe binding to an Oracle Stored Procedure in C#?

We are deploying multiple projects in C# with Oracle databases behind. I would like to implement all of the database logic in Oracle stored procedures as this keeps all of the database logic in the database makes it easier to maintain when database structures change allows re-use of the stored procedures more easily across programming...

Cursor on table type in Oracle

I have a table declaration: TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20)); TYPE PERSON_TYPE_TABLE AS TABLE OF PERSON_TYPE; Can I declare cursor which will be work with my table type in Oracle? ...

Reading SP with output parameters and result set in C#?

I have created a stored procedure similar to this simplified example: CREATE PROCEDURE dbo.sp_MyStoredProcedure @Var1 INT OUTPUT, @Var2 DECIMAL(10,2) OUTPUT AS BEGIN SET NOCOUNT ON; SELECT @Var1 = COUNT(*), @Var2 = SUM(TranAmount) FROM MyTable SELECT * FROM MyTable END When I try to re...

sql server helper stored procedure or utility for alter table alter column IDENTITY(1,1)

I wanted to modify a column in a sql server 2005 table to IDENTITY(1,1) Incidentally this table is empty and the column to be changed is a primary key. This column is also a foreign key for two other tables. After googling I found that you cannot use Alter table syntax to modify a column and make it an indentity column. Link #1 : How...

Is this stored procedure safe from sql injection?

This stored proc executes sql with parameters using sp_executesql. Is it safe from sql injection? create procedure ExecutePeopleFilter (@lastNameFilter varchar(20), @companyNameFilter varchar(20), @ageFilter int, @dateFilter datetime) as begin declare @sql varchar(4000) declare @params varchar(1000) decla...

Oracle 10: Is it possible to access a public synonym to a table in a stored procedure or package?

Hello, I've been trying without success to add a reference to a public synonym in a package or stored procedure in oracle for a while, and I'm wondering if there are solutions to this problem short of accessing the tables directly. For instance: CREATE OR REPLACE PROCEDURE test_func AS test_int INTEGER;<br> BEGIN<br> select coun...

How do I check if a stored procedure exists in SQL Azure?

I normally use the following code in SQL Server: IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[dbo].[proc_MyProc]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [dbo].[proc_MyProc] GO How do I do this in SQL Azure? I get an error message: "Invalid object name 'sysobjects'." Added: The error was in fact in...

Postgres: insertion and deletion

I sense an easier way to do the code. How can I do the deletion/insertion shorter? // to delete the old tags before inserting new tags $result = pg_query_params ( $dbconn, ...

SQL Server spams in event log on every call of extended proc

I've wrote an extended stored procedure in dll. Every time I call it, SQL Server wrote useless "Information" in Windows Event Log (Windows Logs\Application): Event Type: Information Event Source: MSSQLSERVER Event Category: (2) Event ID: 17055 Date: 04.09.2009 Time: 14:54:57 User: N/A Computer: 4STORYTESTDB Description: 8...

My slow T-SQL query needs a complete rethink.

Good afternoon all. I'm going to post the stored procedure in it's entire glory. Feel free to rip it to shreds. The author won't mind. DECLARE @itemTypeID INT SELECT @itemTypeID=ItemTypeID FROM dbo.ItemTypes WHERE ItemTypeName = 'Advert' BEGIN SELECT a.Active, a.ParentClass, a.Classification, a.Variant, FV."Full Views", ...

Using Stored Procedures in C#

I am working on a database application in C#. I had a requirement to display data on a table and I am now done with that. But my business logic is hardcoded to my code. Now I want to go ahead and use Stored procedures with my code. What are the modifications that I need to do. A simple list of steps would be enough :) SqlConnection myCo...

Multi-tier applications with PHP?

Hi all, I am relatively new to PHP, but experienced Java programmer in complex enterprise environments with SOA architecture and multitier applications. There, we'd normally implement business applications with business logic on the middle tier. I am programming an alternative currency system, which should be easy deployable and custom...

Using a Stored Procedure

Hello guys, I want use a stored procedure in my project but I have no idea about it. Please could you tell me a little bit about how to use I can use one in my vb.net application ? ...

Is this a stored procedure?

IS this bit of code in PHP/mysql considered a stored procedure? $sql = 'SELECT username FROM user WHERE username = ? AND passwordHash = ?'; $result = $db->query($sql, array($_POST['username'], $passwordHash)); ...

Calling a web service from Oracle (10g) stored procedure

Hi All. Can anybody point me out on working example of calling web service (e.g. CXF based) from Oracle 10g stored procedure. ...

Is it worth moving from stored procedures to linq ?

I'm looking at standardizing programming in an organisaiton. Half uses stored procedures and the other half Linq. From what i've read there is still some debate going on on this topic. My concern is that MS is trying to slip in it's own proprietry query language 'linq' to make SQL redundant. If a few years back microsoft had tried to...

How to determine size property for stored procedure output parameters in C# data access layer

I've made a data access layer modeled shamelessly off of Castle Project's ActiveRecord implementation. In order for it to gain acceptance, it must support the extensive library of stored procedures in use at my organization, which have been written to use every input/output structure imaginable, including return values and output paramet...