stored-procedures

Oracle stored procedure to return paged resultset

Is there a way for an Oracle stored procedure to return paged resultset (as refcursor) back? For example, I would like to pass to the stored procedure the number of records to return and the page number interested. Then I only want to see those number of records back to my client. How is that done on the Oracle side? i.e. var v_numreco...

mySql input string was not in a correct format

I've done Microsoft SQL server for years.. but just today tried MySql. The question is with vb.net trying to do a save to MySql. The stored proc looks like this. DROP PROCEDURE IF EXISTS test.spAgency_Save; create procedure spAgency_Save (IN p_intTblAgencyID INT, IN p_vcAgency varchar(20),IN p_dtmDate datetime, OUT p_Output INT) begin...

Incorrect syntax error when accessing remote stored procedure

Hello again, StackOverflow - I'm still trying to deploy this site, but with every problem I solve, another arises. Anyways - I've set up the database at my hosting to allow remote connections, and it is running Sql Server 2005. On my development machine, I am working with Sql Server 2008. I've installed the asp.net schema on my hosted ...

T-SQL: Avoid returning result set from stored procedure

Assume I have some stored procedure (and I can't change it) which is returning a result set: create procedure test_procedure as begin select 1 end I know that I can insert result set into table, so it would be hidden to the calling code: declare @t table(i int) insert into @t exec test_procedure Are there any other ways to h...

Temporary Table Scope

I am making use of temporary tables #tempTable in my stored procedure - that I make use to run my ASP.net Reports (Reporting services) I am doing something like eg. Code SELECT * INTO #tempTable FROM Contacts WHERE ContactID < 10 Then I use something like SELECT o.* FROM #tempTable t INNER JOIN Orders o ON t.ContactID =o.ContactID ...

How Can i Let Stored Procedure Returns Varchar Value?

Here is my sample: ALTER PROCEDURE EmpFirstName @myParam int, @empFName varchar(20) output AS BEGIN SET NOCOUNT ON; SELECT @empFName = empfname FROM FE_QEMP WHERE empno = @myParam END GO myParam is the input and empFName will carry the output, so the procedure should only take 1 parameter since empFName is the...

Creating stored procedure and SQLite?

Hey, is it somehow possible to create a stored procedure, when using SQLite? Thanks? ...

how to know if storedproc executed successfully

I am trying to execute a stored proc in java. I know I have to connect to database and do the stuff.... But the thing is How do I know that if that stored proc executed successfully? Thanks. ...

How can I debug an oracle stored procedure from a .net web app?

I have a .net web application that makes heavy use of oracle stored procedures. One of these is problematic - some times it works, some times it doesn't. Is there any way to either attach a debugger to oracle when the sp is called, or step into it directly from Visual Studio? What other debugging techniques are there for a .net/Oracle...

NHibernate calling Oracle stored procedure with schema prefix, how?

I have NHibernate calling stored procedure in Oracle working currently. However, how do I specify a schema prefix in the {call} syntax in the tag? I tried <sql-query name="my_sproc"> <return class="my_sproc_class" /> {call schema2.my_sproc (:p1)} </sql-query> But NHibernate run-time came back with 'schema2' not defined while 'sc...

How can I cause a build error due to mismatch between sproc and calling code?

I have a .NET class (for discussion, ClassA) that calls a SQL Server stored procedure (for discussion, fooSproc), processing the results with a SqlDataReader. The rows are processed, and the columns are referenced using the name of the column in the returned result set. For example, where dr is the SqlDataReader, something like dr["col...

Creating Stored Procedures with SQLAlchemy

Hi, I am writing a python script to create the postgres database using SQLAlchemy. I also want to create Stored Procedures by same way. I checked the SQL Alchemy Documentations but was not able to find whether I can create stored procedure using it or not. Is it Possible to do so? any Tutorials/Examples would help. i found some examples...

SQL: Dynamic Where Clause using IN statement dying on records with NULL values

I am trying to implement search funtionality for our database through a website. The database has one master table and five tables that are foreign keyed to the master (detail tables). Detail tables hold nullable integer values that are hooked to lookup tables in the application. I want to allow a user to select any/all values from a loo...

Are exceptions thrown reliably when using Ado.Net stored procedures?

If I try and call a stored procedure and there is a database error, will that raise as an exception in my C# code? Or do I need to check the result of the stored procedure and raise an exception myself? Eg: using (SqlCommand cmd = new SqlCommand("prc_InsertSomething", conn)) { if (cmd.ExecuteNonQuery() != 1) // should I be doing th...

sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible'.

Hi, I'm new to this. I'm writing a clr stored procedure that calls another stored procedure to get a value that's used in a calculation. A stored procedure returns int (I guess SqlInt32? the type of the value in the table is int) that is then needed to be converted to decimal. Here's the code I have: public static int CalculateMyV...

Problem with stored procedure in LINQ-to-SQL

Hi all, I'm having a never-ending problem with trying to call a stored procedure from a controller - if I could I'd add a bounty to this as it's taken way too much time already and I don't know what else to do (but I don't have the points). Based on my research it seems it's a known bug, but not of the workarounds have worked for me so I...

Have an issue of extrem slow sp and he dont do his job

i got this sp: DROP TABLE IF EXISTS SplitValuesDump; CREATE TABLE SplitValuesDump ( value VARCHAR(1000) NOT NULL PRIMARY KEY ); DELIMITER $$ DROP PROCEDURE IF EXISTS `ChangeSitesRedirects`$$ CREATE PROCEDURE `ChangeSitesRedirects`( prodimainAddress varchar(255), subdomainMainAddress varchar(255) ) SQ...

Call a stored procedure that requires parameters without parameters?

Hello, can I somehow call a stored proc without params, even though it normally has params? Thanks :-) ...

ASP.NET MVC Partial Model Binding from Stored Procedures

Currently, I have a set of stored procedures which are called to populate different fields on a page. I am calling the stored procedures from the LINQ to SQL class that I dropped them on, which works fine. However, it automatically generates (StoredProcedureName)Result class names which I have to work with. Is there anyway to take a s...

mysql create procedure syntax issue line 1

Hello All. I get a syntax error on line 1 of the following procedure: DELIMITER | CREATE PROCEDURE sp_autocallFillCallQueue BEGIN DECLARE maxCalls TINYINT(1); SELECT autocall_maxCalls INTO maxCalls FROM `options` LIMIT 0,1; REPEAT INSERT INTO `callQueue` (`phoneNumber`, 'waiting') SELECT `phoneNumber` FR...