Export only Stored Procedures
Hi all,
Is there any better way of exporting all the stored procedures from a schema other than selecting rows from USER_SOURCE!?
This might help. Or might not.
set long 100000 pagesize 0 feedback off
Select
DBMS_MetaData.Get_DDL(type,name)
From
Select Distinct
type,
name
From
user_source
Where
type != 'PACKAGE BODY' and
name Not Like 'BIN$%'
/
Similar Messages
-
Import only stored procedure packages
Hi,
I would like to import only stored procedure packages, procedures and functions (don't want
tables, views, etc.) from a dump file.
Can I do that?You can use exclude parameter of Datapump Import to exclude the tables and views.To know how to exclude tables this thread is helpful
http://forums.oracle.com/forums/thread.jspa?threadID=425226
And also for exclude and include this link is helpful
http://www.oracle-base.com/articles/10g/OracleDataPump10g.php -
Extracting the DDL(Code) of only stored procedures
DB Version:11g
I have a list of Stored procedures (about 250) whose code ie. CREATE OR REPLACE STORED PROCEDURE statements i want to extract to a file.
Is there an option in imp or impdp where i can extract only the code of these stored procedures?
Apart from imp/impdp , is there any other way to do this?Is there an option in imp or impdp where i can extract only the code of these stored procedures?impdp, Yes. Write the contents to a file using, SQLFILE option.
DUMPFILE = exp.dmp
LOGFILE = exp.log
SCHEMAS=TEST
INCLUDE= PROCEDURE:"IN ('SP')"
SQLFILE=sp..sql
Or use dbms_metadata.get_ddl
set long 99999
set pagesize 0
SELECT DBMS_METADATA.GET_DDL(object_type, object_name, owner) FROM DBA_OBJECTS WHERE OBJECT_TYPE = 'PROCEDURE' and OWNER='OWNER';HTH
-Anantha -
SQL toolkit 2.2 Stored Procedure Memory Leaks
Hi
we are using CVI 2012 and SQL Toolkit 2.2. My db is "MySql 5.5.28" and I use "MySQL Connector/ODBC 5.2(w)"
I use only stored procedure (with and without the output parameters). If I call continuously a stored procedure,
with Sql toolkit code, I have memory leaks!!
My code (without error handler) is:
// iDbConnId is the handle of DBConnect() called when program starts
iStmt = DBPrepareSQL(iDbConnId, "spGetPrData");
DBSetStatementAttribute(iStmt, ATTR_DB_STMT_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
DBExecutePreparedSQL(iStmt);
DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
while(DBFetchNext(iStmt) != DB_EOF)
//get data
DBClosePreparedSQL(iStmt);
DBDiscardSQLStatement(iStmt);
If I call the same stored procedure by sql code ("CALL spProcedure()")
I don't have memory leaks!!
The code is (without error handler):
// iDbConnId is the handle of DBConnect() called when program starts
iStmt = DBActivateSQL(iDbConnId, "CALL spGetPrData();");
DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
while(DBFetchNext(iStmt) != DB_EOF)
//get data
DBDeactivateSQL (iStmt)
It seems to me that the DBDeactivateSQL function free the memory correctly,
while the functions DBClosePreparedSQL and DBDiscardSQLStatement do not release properly the memory,
(or I use improperly the library functions!!!)
I also have a question to ask:
Can I open and close the connection every time I connect to the database or is it mandatory to open and close it just one time?
How can I check the status of the database connection, if is mandatory to open and close the db connection just one time?
Thanks for your help.
Best Regards
PatrizioHi,
one of the functions "DBClosePreparedSQL and DBDiscardSQLStatement" is a known problem. In fact, there is a CAR (Corrective Action Request 91490) reporting the problem. What version of the toolkit are you using?
About this function you refer to the manual:
http://digital.ni.com/manuals.nsf/websearch/D3DF4019471D3A9386256B3C006CDC78
Where functions are described. To avoid memory leaks DBDeactivateSQL must be used. DBDeactivateSQL is equivalent to calling DBCloseSQLStatement, then DBDiscardSQLStatement. DBDeativateSQL will work at all for parameterized SQL, as well.
Regarding the connection mode advice to you is to open the connection once and close it at the end of your operations. What do you mean with "state of the database connection"? Remember that if you have connection problems or something goes wrong, the errors appears in any point in your code where you query the database. Bye
Mario -
Disconnected rowset CachedRowSet from a select inside stored procedure?
Hello everyone
I am using CachedRowSet returning it from a parameterised select statement and it works fine.
If I put the same select statement into a simple read-only stored procedure then I get this exception: "A result set was generated for update".
I am not trying to update the rowset in my code.
I tried to make the CachedRowSet to be read-only but it does not help, same error.
Question 1 : can a stored procedure returning a single result-set be called to populate a read-only CachedRowSet? (in a similar fashion to a CallableStatement prepareCall method with input/output parameters).
Question 2: in general is using CachedRowSet, WebRowSet, FilteredRowSet (disconnected) and JDBCRowSet (connected) something to be encouraged for future develpment or are they deprecated, or replaced by something else/better??
thank you very much in advanceThank you for the initial bite.
This is for Microsoft SQL Server 2008 using Microsoft JDBC driver, type 4.0.
The T-SQL stored procedure has a single select statement in it - see inside code.
Below is the Java 6 source code (including the Java import statements, many unused at the moment), apologies for poor indendation, its a cut and paste problem.
// start of Java code
import java.io.*;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import com.microsoft.sqlserver.jdbc.*;
import com.microsoft.sqlserver.jdbc.SQLServerDriver.*;
import com.microsoft.sqlserver.jdbc.SQLServerDriver;
import java.math.BigDecimal;
import com.sun.rowset.CachedRowSetImpl;
import java.net.MalformedURLException;
import java.net.URL;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import javax.sql.rowset.CachedRowSet;
import javax.sql.rowset.spi.SyncProviderException;
import javax.sql.rowset.spi.SyncResolver;
public class JdbcRowSetTesting
public static void main(String[] args)
String connectionUrl =
"jdbc:sqlserver://ABCDE-SERVER:1433;" +
"databaseName=SecurityTransaction;integratedSecurity=false;user=somedbuser;password=somesortofpassword";
Connection conn = null;
Statement sqlstmt = null;
ResultSet rs = null;
CachedRowSet crs = null;
try
conn = DriverManager.getConnection(connectionUrl);
System.out.println("inside try block, connected");
conn.setAutoCommit(false);
crs = new CachedRowSetImpl();
crs.setUrl(connectionUrl);
crs.setReadOnly(true);
crs.setType(ResultSet.TYPE_FORWARD_ONLY);
crs.setConcurrency(ResultSet.CONCUR_READ_ONLY);
System.out.println("inside try block, connected to CachedRowSet URL");
// this works fine:
crs.setCommand("select ADDRESSID, COUNTRY, POSTCODE, STATE, ADDRESS1, ADDRESS2, ADDRESS3, ADDRESS4, CREATEDBY, CREATEDDATE, UPDATEDBY, UPDATEDDATE from dbo.address where ADDRESSID > ?;");
-- this does not work - the SP has the same SELECT as above inside it:
crs.setCommand("{ call dbo.p_testCachedJDBCRowSet (?) }");
crs.setInt(1, 10);
crs.execute();
while (crs.next())
System.out.println("" + crs.getInt("ADDRESSID") + " " +
crs.getString("ADDRESS1"));
catch (Exception e)
System.out.println("inside catch block, calling Exception printStackTrace(); method now:");
e.printStackTrace();
finally
System.out.println("inside finally block");
if (rs != null) try { rs.close(); } catch(Exception e) { e.printStackTrace(); }
if (sqlstmt != null) try { sqlstmt.close(); } catch(Exception e) { e.printStackTrace(); }
if (conn != null) try { conn.close(); } catch(Exception e) { e.printStackTrace(); }
return;
// end of Java source code -
Stored Procedure vs Views, Please clearify.
Hi Gents,
I am working on client side as a crystal report developer, the client has several applications linked to each other by some means and each application has its own database. They have created a common database called Reporting Layer, the database consists of only stored procedures, that is the stored procedures are collecting data from all the databases and making up a dataset. Now I need to develop reports using these stored procedures. Consider these stored procedures as tables for now.
If you have got the basics, here is my concern about using stored procedures for the reports.
Example : Say I need to refer 3 stored procedures for my report to get the required data then I need to call or attach all the three stored procedures with crystal and link them properly to get the required data. The question here is, say I need only 2 columns from each stored procedure then I simply drag the columns needed and drop on the reports...!!!
So if I had a view instead of a stored procedure then I could refer 3 views in the command object or might have written a stored procedure to return the results containing only the columns the report is ment for.
Select v1.a, v1.b, v2.a, v2.b, v3.a, v3.b from v1,v2,v3 where v1.id = v2.id and v1.id = v3.id
or
Select v1.a, v1.b, v2.a, v2.b, v3.a, v3.b from v1 inner join v2 on v1.id = v2.id inner join v3 on v1.id = v3.id
I want to explain this to my client and ask them to convert all the stored procedures to views, please suggest what can I tell them ? And if you think that the method my client has opted that is of stored procedures is better than views then please explain in this scenario.
Thanks
-AzharHi Azhar,
Not sure if you are in the right place, you would likely get a better description if you post your question to the Forums for which ever DB server you are using. They likely have more detailed info on the efficiencies of each.
For Crystal Reports one possble scenario with using multiple Stored Proceedures (SP) is that each SP would or should be in it's on subreport. Unless you can link them, this will cause the SP to run each time that section is hit. Worst Example is if you put the subreport in the detail section for every record returned the subreport would run. If in the group header for each Group header condition met the subreport would run.
Using them in a Command Object would work but not that efficient and would be better if you used one SP to get the data or use a database to save all the data into as you suggested and report directly off of it.
As for the amount of data the SP returns CR may only ask for the fields used, depends on a few conditions, or it may have to get all of the data and filter out just the fields used in the report. Could be a big delay waiting for the SP to run and/or client side data filtering.
As for Views all the data collection is done server side, same as an SP, but only one view would be required. Or you may want to create specific SP's for use in the reports and not use Command Objects but simply drop the SP into the Database Wizard as the data source. This way all data collection is done server side which is much more efficient and CR at filtering data.
CR does not care if you use Views or SP's, we are simply sending the SQL to the server and waiting for the results. Which one is more efficient is more for that DB forum to answer.
Hope this helps
Don -
How to improve stored procedure performance?
hi,
Suppose I have a stored procedure which contains 30 insert/update statements. How do I know Stored Procedure is slowly running or don't have any performance issue? how to improve performance?
Thanks in advance.
Anujit Karmakar Sr. Software EngineerStored Procedures Optimization Tips
Use stored procedures instead of heavy-duty queries.
This can reduce network traffic, because your client will send to server only stored procedure name (perhaps with some parameters) instead of large heavy-duty queries text. Stored procedures can be used to enhance security and conceal underlying data objects
also. For example, you can give the users permission to execute the stored procedure to work with the restricted set of the columns and data.
Include the SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a Transact-SQL statement.
This can reduce network traffic, because your client will not receive the message indicating the number of rows affected by a Transact-SQL statement.
Call stored procedure using its fully qualified name.
The complete name of an object consists of four identifiers: the server name, database name, owner name, and object name. An object name that specifies all four parts is known as a fully qualified name. Using fully qualified names eliminates any confusion about
which stored procedure you want to run and can boost performance because SQL Server has a better chance to reuse the stored procedures execution plans if they were executed using fully qualified names.
Consider returning the integer value as an RETURN statement instead of an integer value as part of a recordset.
The RETURN statement exits unconditionally from a stored procedure, so the statements following RETURN are not executed. Though the RETURN statement is generally used for error checking, you can use this statement to return an integer value for any other reason.
Using RETURN statement can boost performance because SQL Server will not create a recordset.
Don't use the prefix "sp_" in the stored procedure name if you need to create a stored procedure to run in a database other than the master database.
The prefix "sp_" is used in the system stored procedures names. Microsoft does not recommend to use the prefix "sp_" in the user-created stored procedure name, because SQL Server always looks for a stored procedure beginning with "sp_"
in the following order: the master database, the stored procedure based on the fully qualified name provided, the stored procedure using dbo as the owner, if one is not specified. So, when you have the stored procedure with the prefix "sp_" in the
database other than master, the master database is always checked first, and if the user-created stored procedure has the same name as a system stored procedure, the user-created stored procedure will never be executed.
Use the sp_executesql stored procedure instead of the EXECUTE statement.
The sp_executesql stored procedure supports parameters. So, using the sp_executesql stored procedure instead of the EXECUTE statement improve readability of your code when there are many parameters are used. When you use the sp_executesql stored procedure to
executes a Transact-SQL statements that will be reused many times, the SQL Server query optimizer will reuse the execution plan it generates for the first execution when the change in parameter values to the statement is the only variation.
Use sp_executesql stored procedure instead of temporary stored procedures.
Microsoft recommends to use the temporary stored procedures when connecting to earlier versions of SQL Server that do not support the reuse of execution plans. Applications connecting to SQL Server 7.0 or SQL Server 2000 should use the sp_executesql system
stored procedure instead of temporary stored procedures to have a better chance to reuse the execution plans.
If you have a very large stored procedure, try to break down this stored procedure into several sub-procedures, and call them from a controlling stored procedure.
The stored procedure will be recompiled when any structural changes were made to a table or view referenced by the stored procedure (for example, ALTER TABLE statement), or when a large number of INSERTS, UPDATES or DELETES are made to a table referenced by
a stored procedure. So, if you break down a very large stored procedure into several sub-procedures, you get chance that only a single sub-procedure will be recompiled, but other sub-procedures will not.
Try to avoid using temporary tables inside your stored procedure.
Using temporary tables inside stored procedure reduces the chance to reuse the execution plan.
Try to avoid using DDL (Data Definition Language) statements inside your stored procedure.
Using DDL statements inside stored procedure reduces the chance to reuse the execution plan.
Add the WITH RECOMPILE option to the CREATE PROCEDURE statement if you know that your query will vary each time it is run from the stored procedure.
The WITH RECOMPILE option prevents reusing the stored procedure execution plan, so SQL Server does not cache a plan for this procedure and the procedure is recompiled at run time. Using the WITH RECOMPILE option can boost performance if your query will vary
each time it is run from the stored procedure because in this case the wrong execution plan will not be used.
Use SQL Server Profiler to determine which stored procedures has been recompiled too often.
To check the stored procedure has been recompiled, run SQL Server Profiler and choose to trace the event in the "Stored Procedures" category called "SP:Recompile". You can also trace the event "SP:StmtStarting" to see at what point
in the procedure it is being recompiled. When you identify these stored procedures, you can take some correction actions to reduce or eliminate the excessive recompilations.
http://www.mssqlcity.com/tips/stored_procedures_optimization.htm
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
Import/export only the stored procedure from DMP
Hi all,
pls tell how to import/export only the stored procedure from a DMP file.
Best Regards,
Subirpls tell how to import/export only the stored
procedure from a DMP file.If you on 10g or above use expdp / impdp for import/export only the SP.
Overview of Oracle Data Pump
- Virag Sharma
http://virag.sharma.googlepages.com
http://viragsharma.blogspot.com/ -
Exports hangs in stored procedures
hi i am running oracle 8.1.7 on solaris 8 when i am doing the export the export goes fine but when its reaching exporting stored procedures last after the integrity constraints the export is hanging and giving error
last terminated with unsuccessfully,what may be the reason only for the stored procdures failing in export.How to fix this
wiht regards
ramyshi there is
no errors comming from the export logs.The export hangs and for long time and i have to cancel the export session
and giving export terminated unsuccesfully,how to fix it
with regards
ramya -
Export Java-based external stored procedure
I've got a properly deployed external Java-based stored procedure deployed properly. I can see it by querying user_objects as well as user_java_classes. Is there any way I can export it so that I can deploy it in a different database? Please note that I mean a different way than performing a complete export, I just want to selectively export this external procedure.
Thanks, TomI would think that the following would work:
expdp user/password directory=my_dir dumpfile=java.dmp include=java_source
This would export the java source for the user performing the export. If you need to export java_source for another user, you would have to add
schemas=other_schema
Adding the other schema would only work if the user running the job was privileged.
Dean -
Export stored procedure using sql dev
Hi,
I would like to export stored procedure.
I notice there is a menu in sql dev ('Database Export').
It will saves the export in .sql file.
What is this .sql file will contain?
What is the difference between this .sql file and .dmp file in expdp?
What are the advantages and disadvantages in using these methods?
Thanks.
Edited by: 859102 on Jul 26, 2011 1:34 AM
Edited by: 859102 on Jul 26, 2011 1:35 AMAny sqldev export is in normal readable format, with CREATEs, INSERTs and such.
EXP/EXPDP in contrast stores binary data only readable with IMP/IMPDP.
IMO, the sqldev method is better for small exports (of few objects and/or data), and EXPDP is better for full schema or DB exports as it's a lot faster.
Have fun,
K. -
Line 390 Under the (Insert into SALES_TRADEIN Table)
I need to insert (TradeIn_1_VIN) Values If there is no values in (TradeIn_1_VIN) then i have to insert (TradeIn_2_VIN) values to the (SALES_TRADEIN) Table.
After i run then below script only (TradeIn_2_VIN) values are get inserted in the table. (TradeIn_1_VIN) are not getting loaded in to the table.
I think there is the problem from Line No (404 to 414) Please help me change those particular lines to insert (TradeIn_1_VIN) Values also.If there is no details then (TradeIn_2_VIN) need to be inserted.
-- =============================================
-- Stored Procedure for Flatfile_Sales
-- =============================================
USE [IconicMarketing]
---==========Sales_Cursor
--USE [IconicMarketing]
--GO
DECLARE
@FileType
varchar(50),
@ACDealerID
varchar(50),
@ClientDealerID
varchar(50),
@DMSType
varchar(50),
@DealNumber
varchar(50),
@CustomerNumber
varchar(50),
@CustomerName
varchar(50),
@CustomerFirstName
varchar(50),
@CustomerLastName
varchar(50),
@CustomerAddress
varchar(50),
@CustomerCity
varchar(50),
@CustomerState
varchar(50),
@CustomerZip
varchar(50),
@CustomerCounty
varchar(50),
@CustomerHomePhone
varchar(50),
@CustomerWorkPhone
varchar(50),
@CustomerCellPhone
varchar(50),
@CustomerPagerPhone
varchar(50),
@CustomerEmail
varchar(50),
@CustomerBirthDate
varchar(50),
@MailBlock
varchar(50),
@CoBuyerName
varchar(50),
@CoBuyerFirstName
varchar(50),
@CoBuyerLastName
varchar(50),
@CoBuyerAddress
varchar(50),
@CoBuyerCity
varchar(50),
@CoBuyerState
varchar(50),
@CoBuyerZip
varchar(50),
@CoBuyerCounty
varchar(50),
@CoBuyerHomePhone
varchar(50),
@CoBuyerWorkPhone
varchar(50),
@CoBuyerBirthDate
varchar(50),
@Salesman_1_Number
varchar(50),
@Salesman_1_Name
varchar(50),
@Salesman_2_Number
varchar(50),
@Salesman_2_Name
varchar(50),
@ClosingManagerName
varchar(50),
@ClosingManagerNumber
varchar(50),
@F_AND_I_ManagerNumber
varchar(50),
@F_AND_I_ManagerName
varchar(50),
@SalesManagerNumber
varchar(50),
@SalesManagerName
varchar(50),
@EntryDate
varchar(50),
@DealBookDate
varchar(50),
@VehicleYear
varchar(50),
@VehicleMake
varchar(50),
@VehicleModel
varchar(50),
@VehicleStockNumber
varchar(50),
@VehicleVIN
varchar(50),
@VehicleExteriorColor
varchar(50),
@VehicleInteriorColor
varchar(50),
@VehicleMileage
varchar(50),
@VehicleType
varchar(50),
@InServiceDate
varchar(50),
@HoldBackAmount
varchar(50),
@DealType
varchar(50),
@SaleType
varchar(50),
@BankCode
varchar(50),
@BankName
varchar(50),
@SalesmanCommission
varchar(50),
@GrossProfitSale
varchar(50),
@FinanceReserve
varchar(50),
@CreditLifePremium
varchar(50),
@CreditLifeCommision
varchar(50),
@TotalInsuranceReserve
varchar(50),
@BalloonAmount
varchar(50),
@CashPrice
varchar(50),
@AmountFinanced
varchar(50),
@TotalOfPayments
varchar(50),
@MSRP varchar(50),
@DownPayment
varchar(50),
@SecurityDesposit
varchar(50),
@Rebate
varchar(50),
@Term varchar(50),
@RetailPayment
varchar(50),
@PaymentType
varchar(50),
@RetailFirstPayDate
varchar(50),
@LeaseFirstPayDate
varchar(50),
@DayToFirstPayment
varchar(50),
@LeaseAnnualMiles
varchar(50),
@MileageRate
varchar(50),
@APRRate
varchar(50),
@ResidualAmount
varchar(50),
@LicenseFee
varchar(50),
@RegistrationFee
varchar(50),
@TotalTax
varchar(50),
@ExtendedWarrantyName
varchar(50),
@ExtendedWarrantyTerm
varchar(50),
@ExtendedWarrantyLimitMiles
varchar(50),
@ExtendedWarrantyDollar
varchar(50),
@ExtendedWarrantyProfit
varchar(50),
@FrontGross
varchar(50),
@BackGross
varchar(50),
@TradeIn_1_VIN
varchar(50),
@TradeIn_2_VIN
varchar(50),
@TradeIn_1_Make
varchar(50),
@TradeIn_2_Make
varchar(50),
@TradeIn_1_Model
varchar(50),
@TradeIn_2_Model
varchar(50),
@TradeIn_1_ExteriorColor
varchar(50),
@TradeIn_2_ExteriorColor
varchar(50),
@TradeIn_1_Year
varchar(50),
@TradeIn_2_Year
varchar(50),
@TradeIn_1_Mileage
varchar(50),
@TradeIn_2_Mileage
varchar(50),
@TradeIn_1_Gross
varchar(50),
@TradeIn_2_Gross
varchar(50),
@TradeIn_1_Payoff
varchar(50),
@TradeIn_2_Payoff
varchar(50),
@TradeIn_1_ACV
varchar(50),
@TradeIn_2_ACV
varchar(50),
@Fee_1_Name
varchar(50),
@Fee_1_Fee
varchar(50),
@Fee_1_Commission
varchar(50),
@Fee_2_Name
varchar(50),
@Fee_2_Fee
varchar(50),
@Fee_2_Commission
varchar(50),
@Fee_3_Name
varchar(50),
@Fee_3_Fee
varchar(50),
@Fee_3_Commission
varchar(50),
@Fee_4_Name
varchar(50),
@Fee_4_Fee
varchar(50),
@Fee_4_Commission
varchar(50),
@Fee_5_Name
varchar(50),
@Fee_5_Fee
varchar(50),
@Fee_5_Commission
varchar(50),
@Fee_6_Name
varchar(50),
@Fee_6_Fee
varchar(50),
@Fee_6_Commission
varchar(50),
@Fee_7_Name
varchar(50),
@Fee_7_Fee
varchar(50),
@Fee_7_Commission
varchar(50),
@Fee_8_Name
varchar(50),
@Fee_8_Fee
varchar(50),
@Fee_8_Commission
varchar(50),
@Fee_9_Name
varchar(50),
@Fee_9_Fee
varchar(50),
@Fee_9_Commission
varchar(50),
@Fee_10_Name
varchar(50),
@Fee_10_Fee
varchar(50),
@Fee_10_Commission
varchar(50),
@ContractDate
varchar(50),
@InsuranceName
varchar(50),
@InsuranceAgentName
varchar(50),
@InsuranceAddress
varchar(50),
@InsuranceCity
varchar(50),
@InsuranceState
varchar(50),
@InsuranceZip
varchar(50),
@InsurancePhone
varchar(50),
@InsurancePolicyNumber
varchar(50),
@InsuranceEffectiveDate
varchar(50),
@InsuranceExpirationDate
varchar(50),
@InsuranceCompensationDeduction
varchar(50),
@TradeIn_1_InteriorColor
varchar(50),
@TradeIn_2_InteriorColor
varchar(50),
@PhoneBlock
varchar(50),
@LicensePlateNumber
varchar(50),
@Cost varchar(50),
@InvoiceAmount
varchar(50),
@FinanceCharge
varchar(50),
@TotalPickupPayment
varchar(50),
@TotalAccessories
varchar(50),
@TotalDriveOffAmount
varchar(50),
@EmailBlock
varchar(50),
@ModelDescriptionOfCarSold
varchar(50),
@VehicleClassification
varchar(50),
@ModelNumberOfCarSold
varchar(50),
@GAPPremium
varchar(50),
@LastInstallmentDate
varchar(50),
@CashDeposit
varchar(50),
@AHPremium
varchar(50),
@LeaseRate
varchar(50),
@DealerSelect
varchar(50),
@LeasePayment
varchar(50),
@LeaseNetCapCost
varchar(50),
@LeaseTotalCapReduction
varchar(50),
@DealStatus
varchar(50),
@CustomerSuffix
varchar(50),
@CustomerSalutation
varchar(50),
@CustomerAddress2
varchar(50),
@CustomerMiddleName
varchar(50),
@GlobalOptOut
varchar(50),
@LeaseTerm
varchar(50),
@ExtendedWarrantyFlag
varchar(50),
@Salesman_3_Number
varchar(50),
@Salesman_3_Name
varchar(50),
@Salesman_4_Number
varchar(50),
@Salesman_4_Name
varchar(50),
@Salesman_5_Number
varchar(50),
@Salesman_5_Name
varchar(50),
@Salesman_6_Number
varchar(50),
@Salesman_6_Name
varchar(50),
@APRRate2
varchar(50),
@APRRate3
varchar(50),
@APRRate4
varchar(50),
@Term2
varchar(50),
@SecurityDeposit2
varchar(50),
@DownPayment2
varchar(50),
@TotalOfPayments2
varchar(50),
@BasePayment
varchar(50),
@JournalSaleAmount
varchar(50),
@IndividualBusinessFlag
varchar(50),
@InventoryDate
varchar(50),
@StatusDate
varchar(50),
@ListPrice
varchar(50),
@NetTradeAmount
varchar(50),
@TrimLevel
varchar(50),
@SubTrimLevel
varchar(50),
@BodyDescription
varchar(50),
@BodyDoorCount
varchar(50),
@TransmissionDesc
varchar(50),
@EngineDesc
varchar(50),
@TypeCode
varchar(50),
@SLCT2
varchar(50),
@DealDateOffset
varchar(50),
@AccountingDate
varchar(50),
@CoBuyerCustNum
varchar(50),
@CoBuyerCell
varchar(50),
@CoBuyerEmail
varchar(50),
@CoBuyerSalutation
varchar(50),
@CoBuyerPhoneBlock
varchar(50),
@CoBuyerMailBlock
varchar(50),
@CoBuyerEmailBlock
varchar(50),
@RealBookDate
varchar(50),
@CoBuyerMiddleName
varchar(50),
@CoBuyerCountry
varchar(50),
@CoBuyerAddress2
varchar(50),
@CoBuyerOptOut
varchar(50),
@CoBuyerOccupation
varchar(50),
@CoBuyerEmployer
varchar(50),
@Country
varchar(50),
@Occupation
varchar(50),
@Employer
varchar(50),
@Salesman2Commission
varchar(50),
@BankAddress
varchar(50),
@BankCity
varchar(50),
@BankState
varchar(50),
@BankZip
varchar(50),
@LeaseEstimatedMiles
varchar(50),
@AFTReserve
varchar(50),
@CreditLifePrem
varchar(50),
@CreditLifeRes
varchar(50),
@AHRes
varchar(50),
@Language
varchar(50),
@BuyRate
varchar(50),
@DMVAmount
varchar(50),
@Weight
varchar(50),
@StateDMVTotFee
varchar(50),
@ROSNumber
varchar(50),
@Incentives
varchar(50),
@CASS_STD_LINE1
varchar(50),
@CASS_STD_LINE2
varchar(50),
@CASS_STD_CITY
varchar(50),
@CASS_STD_STATE
varchar(50),
@CASS_STD_ZIP
varchar(50),
@CASS_STD_ZIP4
varchar(50),
@CASS_STD_DPBC
varchar(50),
@CASS_STD_CHKDGT
varchar(50),
@CASS_STD_CART
varchar(50),
@CASS_STD_LOT
varchar(50),
@CASS_STD_LOTORD
varchar(50),
@CASS_STD_URB
varchar(50),
@CASS_STD_FIPS
varchar(50),
@CASS_STD_EWS
varchar(50),
@CASS_STD_LACS
varchar(50),
@CASS_STD_ZIPMOV
varchar(50),
@CASS_STD_Z4LOM
varchar(50),
@CASS_STD_NDIAPT
varchar(50),
@CASS_STD_NDIRR
varchar(50),
@CASS_STD_LACSRT
varchar(50),
@CASS_STD_ERROR_CD
varchar(50),
@NCOA_AC_ID
varchar(50),
@NCOA_COA_ADDSRC
varchar(50),
@NCOA_COA_MATCH
varchar(50),
@NCOA_COA_MOVTYP
varchar(50),
@NCOA_COA_DATE
varchar(50),
@NCOA_COA_DELCD
varchar(50),
@NCOA_COA_RTYPE
varchar(50),
@NCOA_COA_RTNCD
varchar(50),
@NCOA_COA_LINE1
varchar(50),
@NCOA_COA_LINE2
varchar(50),
@NCOA_COA_CITY
varchar(50),
@NCOA_COA_STATE
varchar(50),
@NCOA_COA_ZIP
varchar(50),
@NCOA_COA_ZIP4
varchar(50),
@NCOA_COA_DPBC
varchar(50),
@NCOA_COA_CHKDGT
varchar(50),
@NCOA_COA_CART
varchar(50),
@NCOA_COA_LOT
varchar(50),
@NCOA_COA_LOTORD
varchar(50),
@NCOA_COA_URB
varchar(50),
@NCOA_COA_Z4LOM
varchar(50),
@NCOA_COA_ACTION
varchar(50),
@NCOA_COA_QNAME
varchar(50),
@NCOA_DPV_AA
varchar(50),
@NCOA_DPV_A1
varchar(50),
@NCOA_DPV_BB
varchar(50),
@NCOA_DPV_CC
varchar(50),
@NCOA_DPV_M1
varchar(50),
@NCOA_DPV_M3
varchar(50),
@NCOA_DPV_N1
varchar(50),
@NCOA_DPV_P1
varchar(50),
@NCOA_DPV_P3
varchar(50),
@NCOA_DPV_RR
varchar(50),
@NCOA_DPV_R1
varchar(50),
@NCOA_DPV_STATUS
varchar(50),
@NCOA_DPV_F1
varchar(50),
@NCOA_DPV_G1
varchar(50),
@NCOA_DPV_U1
varchar(50),
@myerror
varchar(500),
@SalesID
int,
@errornumber int,
@errorseverity varchar(500),
@errorstate int,
@errorprocedure varchar(500),
@errorline varchar(50),
@errormessage varchar(1000);
DECLARE Sales_Cursor CURSOR FOR
SELECT * from FLATFILE_SALES;
OPEN Sales_Cursor;
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @VehicleVIN ;
--===============================================================================
-- ****************** insert into Sales Table ***********
BEGIN TRY
INSERT INTO Sales
IconicDealerID,
DealNumber,
CustomerNumber,
DMSType,
ContractDate
VALUES (@ClientDealerID,@DealNumber,@CustomerNumber,@DMSType,@ContractDate);
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER()
,@errorseverity = ERROR_SEVERITY()
,@errorstate = ERROR_STATE()
,@errorprocedure = ERROR_PROCEDURE()
,@errorline = ERROR_LINE()
,@errormessage = ERROR_MESSAGE();
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
@errornumber ,
@errorseverity ,
@errorstate,
@errorprocedure,
@errorline,
@errormessage);
END CATCH
PRINT @errornumber;
PRINT @errorseverity;
PRINT @errorprocedure;
PRINT @errorline;
PRINT @errormessage;
PRINT @errorstate;
set @myerror = @@ERROR;
-- This PRINT statement prints 'Error = 0' because
-- @@ERROR is reset in the IF statement above.
PRINT N'Error = ' + @myerror;
set @SalesID = scope_identity();
PRINT @SalesID;
--================================================================================
--Insert into SALES_TRADEIN Table
BEGIN TRY
INSERT INTO SALES_TRADEIN
SalesID,
TradeIn_VIN,
TradeIn_Make,
TradeIn_Model,
TradeIn_ExteriorColor,
TradeIn_Year,
TradeIn_Mileage,
TradeIn_Gross,
TradeIn_Payoff,
TradeIn_ACV,
TradeIn_InteriorColor
VALUES
@SalesID,
case when @TradeIn_1_VIN is not null then @TradeIn_2_VIN end,
case when @TradeIn_1_Make is not null then @TradeIn_2_Make end,
case when @TradeIn_1_Model is not null then @TradeIn_2_Model end,
case when @TradeIn_1_ExteriorColor is not null then @TradeIn_2_ExteriorColor end,
case when @TradeIn_1_Year is not null then @TradeIn_2_Year end,
case when @TradeIn_1_Mileage is not null then @TradeIn_2_Mileage end,
case when @TradeIn_1_Gross is not null then @TradeIn_2_Gross end,
case when @TradeIn_1_Payoff is not null then @TradeIn_2_Payoff end,
case when @TradeIn_1_ACV is not null then @TradeIn_2_ACV end,
case when @TradeIn_1_InteriorColor is not null then @TradeIn_2_InteriorColor end
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER()
,@errorseverity = ERROR_SEVERITY()
,@errorstate = ERROR_STATE()
,@errorprocedure = ERROR_PROCEDURE()
,@errorline = ERROR_LINE()
,@errormessage = ERROR_MESSAGE();
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
END CATCHThis is what I've understood from your question. You want to replace @TradeIn_2_VIN value if @TradeIn_1_VIN
is NULL, else the value of @TradeIn_1_VIN.
If this is the requirement then, your CASE statement is missing ELSE part. You can re-write this as below
case when @TradeIn_1_VIN is null then @TradeIn_2_VIN
ELSE @TradeIn_1_VIN end,
or simply you can replace the CASE statement with the below
COALESCE function,
COALESCE(@TradeIn_1_VIN, @TradeIn_2_VIN),
Krishnakumar S -
Hi Guys,
SSIS 2012 ETL is failing only at one server (No BIDS) but running successfully from BIDS on different sever . In this ETL, I have used Stored Procedure in OLEDB Source.
Note: I have couple of ETLs developed in 2005 using same logic and upgraded to 2012, working perfectly.
I am getting Error Message:
SSIS
Error Code
DTS_E_OLEDBERROR.
An OLE DB
error has occurred.
Error code: 0x80004005.
An
OLE DB
record is available.
Source: "Microsoft OLE DB Provider for SQL Server"
Hresult: 0x80004005
Description: "Error converting data type varchar to datetime.".
Unable
to retrieve
column information
from the data
source. Make
sure your target
table in
the database is
available.
"OLE DB Source"
failed validation
and returned
validation status
"VS_ISBROKEN".
I tried below word around and found It is working perfectly.
I loaded data into a table (dbo.TEMP) using Stored procedure and then I used this dbo.TEMP table in OLEDB source and then found no issue.
MY SP Details: (This SP I am calling in OLEDB source of ETL) and when I run it from one server IT is working fine and when I run from ETL dedicated Server getting error: Guys Help me out.
USE
[TEST_DB]
GO
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
ALTER
PROCEDURE [DBO].[SP_TEST]
--EXEC [DBO].[SP_TEST] '2014-09-30','2014-10-01'
@FROMDATETIME
DATETIME,
@TODATETIME
DATETIME
AS
SET
NOCOUNT ON
BEGIN
DECLARE
@FROMDATEKEY INT,
@TODATEKEY INT,
SET
@FROMDATEKEY=
CONVERT(VARCHAR(10),@FROMDATETIME,112)
SET
@TODATEKEY=
CONVERT(VARCHAR(10),@TODATETIME,112)
IF 1 = 1
BEGIN
SELECT
CAST(NULL
AS DATETIME)
AS TXN_DATE
, CAST(NULL
AS DATETIME
) AS PROCESS_DATE
, CAST(NULL
AS money)
AS S1_AMT
, CAST(NULL
AS money)
AS S2_AMOUNT
, CAST(NULL
AS money)
AS S2_INVALID_AMOUNT
, CAST(NULL
AS money)
AS INVALID_MOVED_IN_VALID_S2_AMOUNT
, CAST(NULL
AS VARCHAR(20))
AS SYSTEM_ID
, CAST(NULL
AS money)
AS S3_AMT
END
SELECT
TXN_DATE
,PROCESS_DATE
,S1_AMT
,S2_AMOUNT
,S2_INVALID_AMOUNT
,INVALID_MOVED_IN_VALID_S2_AMOUNT
,SYSTEM_ID
S3_AMT
FROM
DBO.TABLE_1
WHERE TNX_DATE_KEY
BETWEEN @FROMDATEKEY
and @TODATEKEY
UNION
ALL
SELECT
TXN_DATE
,PROCESS_DATE
,S1_AMT
,S2_AMOUNT
,S2_INVALID_AMOUNT
,INVALID_MOVED_IN_VALID_S2_AMOUNT
,SYSTEM_ID
S3_AMT
FROM
DBO.TABLE_2
WHERE TNX_DATE_KEY
BETWEEN @FROMDATEKEY
and @TODATEKEY
UNION
ALL
SELECT
TXN_DATE
,PROCESS_DATE
,S1_AMT
,S2_AMOUNT
,S2_INVALID_AMOUNT
,INVALID_MOVED_IN_VALID_S2_AMOUNT
,SYSTEM_ID
S3_AMT
FROM
DBO.TABLE_3
WHERE TNX_DATE_KEY
BETWEEN @FROMDATEKEY
and @TODATEKEY
END
Data Source Mode: SQL Command for Variable
"EXEC [DBO].[SP_TEST] '"+ (DT_WSTR, 24) @[User::V_EXTRACT_FROM_DT] +"','"+ (DT_WSTR, 24) @[User::V_EXTRACT_TO_DT] +"'"
Where variable @[User::V_EXTRACT_FROM_DT] and @[User::V_EXTRACT_TO_DT] is defined as DATETIME
Thanks Shiven:) If Answer is Helpful, Please VoteHi,
Yes you are right. At one sever where I was getting error, DateTime was in USA format and Where It was running successfully was in AUS format.
I changed from USA to AUS and I did another changes:
Data Source Mode: SQL
Command
EXEC [DBO].[SP_TEST]
@FROMDATETIME = ?,
@TODATETIME = ?
and It is working fine.
Thanks Shiven:) If Answer is Helpful, Please Vote -
Calling stored procedure from DRM export
Hi All,
I am new to drm .I have a question.Is it possible to run stored procedure automatically when drm export ran.
I Have a DRM HUb where i am actually downloading all the tables.I have a requirement to run stored procedure when drm exports ran.
Is it Possible?Hi,
I have these exports from drm.Do we have batch commands in DRM
When these DRM exports ran, Is there a way that i can trigger my stored procedure -
Stored Procedure Call with only Input Parameter
Hi, The Example at Oracle Toplink Developer's Guide, Volume 5 uses an output param named IS_VALID. How Can I Call a Stored Procedure that has only Input Param ? If I don't use an Ouput Param Toplink throw the following Exception:
*Excepción [TOPLINK-4002]* (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070620)): oracle.toplink.exceptions.DatabaseException Excepción Interna: java.sql.SQLException: ORA-00900: invalid SQL statement
Here's the Sample Code Depicted at the Guide:*
Example 98–48 Stored Procedure Call with an Output Parameter
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("CHECK_VALID_POSTAL_CODE");
call.addNamedArgument("POSTAL_CODE");
call.addNamedOutputArgument(
"IS_VALID", // procedure parameter name
"IS_VALID", // out argument field name
Integer.class // Java type corresponding to type returned by procedure
ValueReadQuery query = new ValueReadQuery();
query.setCall(call);
query.addArgument("POSTAL_CODE");
Vector parameters = new Vector();
parameters.addElement("L5J1H5");
Number isValid = (Number) session.executeQuery(query,parameters);
Here's my code
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("MYSTOREDPROCEDURE");
call.addNamedArgument("INPUTPARAM1");
call.addNamedArgument("INPUTPARAM2");
call.addNamedArgument("INPUTPARAM3");
call.addNamedArgument("INPUTPARAM4");
call.addNamedArgument("INPUTPARAM5");
call.addNamedArgument("INPUTPARAM6");
ValueReadQuery query = new ValueReadQuery();
query.setCall(call);
query.addArgument("INPUTPARAM1");
query.addArgument("INPUTPARAM2");
query.addArgument("INPUTPARAM3");
query.addArgument("INPUTPARAM4");
query.addArgument("INPUTPARAM5");
query.addArgument("INPUTPARAM6");
Vector parameters = new Vector();
parameters.addElement("INPUTVALUE1");
parameters.addElement("INPUTVALUE2");
parameters.addElement("INPUTVALUE3");
parameters.addElement("INPUTVALUE4");
parameters.addElement("INPUTVALUE5");
parameters.addElement("INPUTVALUE6");
uow.executeQuery(query,parameters);
Regards,
ManuelYou need to use a DataModifyQuery as your query does not return anything.
James : http://www.eclipselink.org
Maybe you are looking for
-
How to manage itunes video HD and SD versions ?
I'd like to figure this out... When buying itunes movies that come in HD, both the HD and SD (for iphones) versions are downloaded. Both versions are located in the itunes media folder under that movies title/name. In the itunes movies list, only one
-
HOW TO: Create a JSP Edit Record Form Using BC4J Data Tags
This is a JDeveloper Tech Note found on the OTN Documentation page. This note describes the use of the BC4J data tags to create row edit/submit JSP pages. Here is the link: http://technet.oracle.com/docs/products/jdev/technotes/datatag_input/Edit_For
-
Using Variable in place of property name in set_item_property procedure.
Hello, I need to change the item properties dynamically by using variables for both properties names and their values.But during compilation its showing me error "Too many declrations".Kindly suggest me any best way.
-
Toshiba 52HL167 popped and turned off - red light flashing
While on, the TV made a pop noise and lost power. I let it cool overnight, but when I try to turn it on now, it makes some clicking noises as if it is trying to turn on from the middle top of one of the boards labeled "PE0365". Do I need to replace
-
App store on Iphne botton purchased apps
is it possible for privacy remove or protect with password the list of purchased apps from the botton of App Store in the display of Iphone?