PL/SQL usage in Datawarehousing projects
Hi,
In Datawarehousing projects, most of the processing can be done through SQL code directly.
I found from few articles that we should strongly avoid PL/SQL Scripts in DWH projects.
But, if situation warrants, can we use PL/SQL for processing in D/W projects, is it advisable?
Please suggest, thank you.
Regards,
DR
PL/SQL is used instead of single SQL statements due to the "BULK COLLECT/FORALL" functionality which reduces the size of redo operations.It uses more redo, not less.
Tested in 11.1.0.6:
SQL> @desc one_million_rows
Name Null? Type
ID NUMBER
VAL VARCHAR2(30)
SQL> set autotrace on statistics
SQL> insert into test_redo select * from one_million_rows;
1000000 rows created.
Statistics
0 recursive calls
42508 db block gets
16959 consistent gets
5827 physical reads
48187952 redo size
920 bytes sent via SQL*Net to client
1017 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
1000000 rows processed
SQL> roll
Rollback complete.
SQL> set autotrace off
SQL> SELECT s.value FROM v$mystat s JOIN v$statname n USING (statistic#)
2 WHERE n.name = 'redo size';
VALUE
317239240
1 row selected.
SQL> DECLARE
2 CURSOR c IS SELECT * FROM one_million_rows;
3 TYPE t IS TABLE OF one_million_rows%ROWTYPE;
4 v_rows t;
5 BEGIN
6 OPEN c;
7 LOOP
8 FETCH c BULK COLLECT INTO v_rows LIMIT 500;
9
10 FORALL i IN v_rows.FIRST..v_rows.LAST
11 INSERT INTO test_redo VALUES v_rows(i);
12
13 EXIT WHEN c%NOTFOUND;
14 END LOOP;
15 END;
16 /
PL/SQL procedure successfully completed.
SQL> SELECT s.value FROM v$mystat s JOIN v$statname n USING (statistic#)
2 WHERE n.name = 'redo size';
VALUE
365731476
1 row selected.
SQL> select 365731476 - 317239240 redo from dual;
REDO
48492236
1 row selected.The PL/SQL block used 304,284 bytes more redo, which is not much but still more than the SQL version.
Similar Messages
-
Using SQLCMD variables in SQL Server Unit Test Project
Is it possible to use SQLCMD variables in my SQL Server Unit Test Project? In my test initialize script I'd like to set a database name variable, something like this:
:SETVAR MyDatabase "mydatabase"
SELECT * FROM [$(MyDatabase)].[mytable]
but I get syntax errors when I run the test. Any suggestions how I can get this to work.
Result Message: Initialization method
myTest.TestInitialize threw exception. System.Data.SqlClient.SqlException: System.Data.SqlClient.SqlException:
Incorrect syntax near ':'..Hi Kevin,
What is the error?
This should work only thing i could see is no scheme specified.
SQL Server uses dbo as default schema.
In your case:
:SETVAR MyDatabase "mydatabase"
SELECT * FROM [$(MyDatabase)].dbo.[mytable]
Also check your instance collation if its Case sensitive then specify database and table name as exact case.
Example:
:SETVAR MyDatabase "[mydatabase]"
:setvar schemavar "[dbo]"
:setvar tablevar "[mytable]"
SELECT * FROM $(MyDatabase).$(schemavar).$(tablevar) -
SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007
Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!
Refer
http://gallery.technet.microsoft.com/projectserver/Server-20072010-SQL-Get-a99d4bc6
SELECT
dbo.MSP_EpmAssignment_UserView.ProjectUID,
dbo.MSP_EpmAssignment_UserView.TaskUID,
dbo.MSP_EpmProject_UserView.ProjectName,
dbo.MSP_EpmTask_UserView.TaskName,
dbo.MSP_EpmAssignment_UserView.ResourceUID,
dbo.MSP_EpmResource_UserView.ResourceName,
dbo.MSP_EpmResource_UserView.ResourceInitials
INTO #TempTable
FROM dbo.MSP_EpmAssignment_UserView INNER JOIN
dbo.MSP_EpmProject_UserView ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID INNER JOIN
dbo.MSP_EpmTask_UserView ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID INNER JOIN
dbo.MSP_EpmResource_UserView ON dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID
SELECT
ProjectUID,
TaskUID,
ProjectName,
TaskName,
STUFF((
SELECT ', ' + ResourceInitials
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceInitialsCombined,
STUFF((
SELECT ', ' + ResourceName
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceNameCombined
FROM #TempTable Results
GROUP BY TaskUID,ProjectUID,ProjectName,TaskName
DROP TABLE #TempTable
-Prashanth -
PL/SQL in an enterprise project
I want to see how to use PL/SQL in an enterprise project. I am looking for a project:
1. open source
2. heavily , heavily use PL/SQL
3. front end uses java and jsp.
Do you have any recommendation ?
ThanksEnterprise project as open source? Those are very few and far in between.
And why the use of Java/JSP as the front-end? PL/SQL is as capable as doing the front-end too. -
Where Could I Find SQL or PL/SQL Practical Tasks or Projects???
Hi everyone,
In order to improve my SQL and PL/SQL skills by myself, I am looking for some SQL or PL/SQL tasks or projects online. Does anyone know any website or anything about it?
I really appreciate your help from now on.
ThanksThree steps for honing SQL skills first.. SQL is the foundation :)
Answer the questions asked in the forums -- begin with simple sql statements. (By this way atleast u will make an attempt to provide solution after u solve them)
Even if someone answers it already, try to provide alternate best solution (By this way u will try to think different)
If someone contradicts you, provide justification if your argument is valid (by this way u will check the documentation of oracle)
Cheers,
Manik. -
SQL*LOADER/SQL usage in Migration
I have very limited migration requirements. I DO NOT need to
migrate a database. I DO need to change some SQL and BCP load
scripts from SQL-SERVER 6.5 to their equivalents in ORACLE 8.0.5.
For this limited purpose, should I proceed to handcode these, or
would the workbench be of use to me?
Thanks for your help.
nullThe migration workbench does, as part of the migration,
generate the BCP and SQL*Loader files required to migrate a
database. However, since you already have the BCP files created
then the Workbench would not actually be able to just generate
the other side of the picture (the SQL*Loader files). I can
suggest the following to you :
1. Perhaps use the Workbench to run a tiny migration that would
show you how we generate the SQL*Loader scripts. It is fairly
straight forward however we need to do some manipulation on
dates.
2. There is a chapter on SQL*Loader as part of the Oracle8i
documentation set.
Chapter 3 "SQL*Loader Concepts"
Oracle8i Utilities, Release 8.1.5
A67792-01
Regards,
Marie
Raja Marla (guest) wrote:
: I have very limited migration requirements. I DO NOT need to
: migrate a database. I DO need to change some SQL and BCP
load
: scripts from SQL-SERVER 6.5 to their equivalents in ORACLE
8.0.5.
: For this limited purpose, should I proceed to handcode these,
or
: would the workbench be of use to me?
: Thanks for your help.
Oracle Technology Network
http://technet.oracle.com
null -
Sql usage for user login screen in uix
I am very new to Jdeveloper so many things remain a mystery at this point. I'm using version 9.0.3.3.
I implemented a login screen using the example supplied in the uix developer guide and the solution works great except for the un-implemented method from the sample java program
if (password.equals(getPasswordForUser(userName)))
I need some help in how to implement this method. Conceptually, it is simple. Just a sql statement that searches the user file for a match on user name and password and either returns a single row or nothing.
The user interface screen works and passes down the user id and password and I made the java program work by hard coding in the user id and password rather than go to the database.
Any help would be greatly appreciated.
Thanks
Steve OliphantIf you figured this out, please share some code. In a nutshell I have some code that does not work, and have posted several questions on forum. So far no luck. The only way I made it work is to have dummy binding of USERS VO on my login page. Weird?
-
About PL/SQL usage!!!
Where do I use PL/SQL procedures for example? Do I put the calls to them in java methods?
There is no simple answer to such a simple question.
When I analyze your question I think that you are struggeling with an application architecture matter. Basically, the first answer that springs to mind would be:
- You should use PL/SQL when you have to implement functionality that is databound.
In other words: when your process is about manipulating data rather than doing complex arithmetic, you should use PL/SQL.
When it comes to the question on how to integrate the PL/SQL code with the other components that make up your information system, than the question is raised what type of information system you are building and what the infrastructure is on which it will be running.....
In all cases, please realise that PL/SQL code is running in the database tier of your application infrastructure!!!
Hope this helps...
Message was edited by:
Toine -
Hello,
I have a Visual Studio 2010 C# class with a method that invokes/consumes a web service and returns an XML dataset. I am traversing through the parent/child nodes and parsing out the data then inserting it into a SQL Server 2008 R2 table for a join within
another stored procedure.
Instead of using a 3rd party API to generate the PDF for this data, I am creating an SSRS report. The formatting will be easier and I can do a RenderFormat directly to PDF.
Can I expect to be able to transfer the code-behind method to this report and have it be able to work with the web service the same way? It is a SOAP-based web service returning parent nodes and two levels of nested child nodes.
I have also been researching the approach of calling the web service in the same stored procedure that is currently querying the physical tables (which is used to populate a gridview and PDF) but it looks like it may only be possible with a CLR stored procedure.
Is it possible to implement a CLR stored procedure within an SSRS report?
Hope this makes sense. Any help, suggestion or point in the right direction would be greatly appreciated.
Thanks,
BusterHi Buster,
SSRS supports web service data source, we can call the SOAP-based web service in SSRS report directly. Then, we can use custom code in SSRS to parse the XML data. However, we won’t be able to join another data in SQL Server database.
Reference:http://technet.microsoft.com/en-us/library/aa964129(v=sql.90).aspx#repservxmlds_topic3
We cannot implement a CLR stored procedure within an SSRS report directly. In order to execute the CLR store procedure in a SSRS report, we have to execute it as text using the following code:
Exec <stored procedure name>
Reference:
http://dotnetslackers.com/Community/blogs/bmains/archive/2009/01/15/executing-a-clr-stored-procedure-in-reporting-services.aspx
Hope this helps.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
Template Project Usage in Implementation Project
hi,
I have defined the Template project in Solar_project_admin. Now how I can use this template project in Implementation project.
What are the steps of copying the template project into implemenation project.
Regards
PKHi Aditya,
Many Thanks. I am new to this feature ( Template project & roll out). My requirement is like, I need to define one template project & same has to be rolled out in other contries implementation projects. This is in a broder sense.
Now what are the steps to go about. How to proceed.
Will there be only one Solution Manager or different countries will have sepearte Solman. Will one Solman will do all rollouts.
Can you give me some useful stuff as a biginner, how the project management is used ( especially Template project & roll out )
Regards
PK -
Hi,
We use TMS version 14.6
I need change default ports used by SQL server (destination ports TCP 1433 ->TCP 3341)
Please find sheet or give advise
Thank youIf you run the TMS Tools application (C:\Program Files (x86)\TANDBERG\TMS\TMSTools\TMSTools.exe) and go to the Configuration Tab, that lets you change the Port from the detault 1433.
Wayne
Please remember to rate responses and to mark your question as answered if appropriate. -
SQL Server 2012 database project
Hi guys,
How to include roles of database and permissions at object level to the project? It does not fetch eiher of them from existing datbase.
Regards,
Navin
Navin.D http://dnavin.wordpress.comsee
http://schottsql.blogspot.in/2013/05/ssdt-setting-different-permissions-per.html
http://sqlblog.com/blogs/jamie_thomson/archive/2010/07/21/a-strategy-for-managing-security-for-different-environments-using-the-database-development-tools-in-visual-studio-2010.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
External Hard Drive Usage for Saving Projects
Hi Folks
I'm really getting into iMovie now, but the consequence is that my Internal Hardrive is getting a little cramped. I have a 250GB Seagate External Drive which is partitoned half Windows and half MAC OSX Extended.
My question is a simple one.
Can I use the MAC Partitioned part of my External Harddrive to store projects in their entirety or will it mess with the paths to the various clips within the iMovie project.
The External Drive is connected via Firewire.
Thanks in advance for any answers
A.L.IKarl,
I'm embarrassed to say that until I encountered my first network with both Macs and non-Apple equipment on it, I thought that only Macs had MAC Addresses.
Imagine my surprise when I was asked to retrieve the MAC Address of an HP Printer. Fortunately, the printer was brand new and the manual was setting right next to it so I quickly looked in the index.
That saved me from having to admit my confusion to my co-worker.
So I do think that MAC Addresses may lead folks to refer to Macs as MACS! That, or perhaps because PC is all caps that it seems logical that Mac should be all caps too.
Matt -
Hello Everyone,
Can somone tell when or where to use Dynamic sql ( exec sp_executesql and exec commands) over normal sql ?
Regards
RegardsDynamic SQL queries should be avoided and one should put more thought and time on creating non-dynamic SQL statements.
But there could be some rare scenarios or requirements where you need to create Dynamic SQL, like doing some multiple DBA activities in one go, like:
- Enabling/Disabling multiple Jobs at once,
link.
- Creating Dynamic PIVOT where there could be multiple columns based on multiple rows,
link.
Check
this blog post for EXECUTE vs sp_executesql.
~manoj | email: http://scr.im/m22g
http://sqlwithmanoj.wordpress.com
MCCA 2011 | My FB Page -
We will often drop ship for customers. I have created a UDF to use as the ship to company name if we are not using the BP name. What I would like to do is have PLD use this if it is populated, but use CardName if it isn't (on our Packing Lists). If it were a query I could use:
CASE WHEN ODLN.U_ShipToCo IS NULL THEN OCRD.CardName ELSE ODLN.U_ShipToCo
I tried creating a new field and using the formula option, but that seems to want to only work with mathematical functions.
Any suggestions?
Thanks!
MonicaHi Monica,
Try this,
Case 1
->> Create 1 UDF in Header level on Marketing Documents.
->> Assign the below FMS in UDF. This FMS will retrieve the Current CardCode (or) U_ShipToCo value.
->> put the UDF field in PLD.
Ex.
Table - ODLN.
Column - U_ShipToCo.
it will be work exactly.
SELECT DISTINCT
CASE WHEN $[ODLN.U_ShipToCo] = ' ' THEN $[ODLN.CardCode]
WHEN $[ODLN.U_ShipToCo] != ' ' THEN $[ODLN.U_ShipToCo]
ELSE 'NULLVALUE' END
FROM ODLN
Example:
Field_123 -> CardCode.
Field_456 -> U_ShipToCo value.
Case 2
->> Open the PLD and Create 2 database field in header.
->> 1 Database field is retrieve the CardCode Value and Another 1 Database field is retrieve the U_ShipToCo Value.
->> Create 1 Formula field in Header and assign the formula for Link to CardCode.
Formula Field ID - Field_789
Field_456==' '
->> Click Content Tab and Assign the Link to fields on Properties Window.
Link To
Field_123 Link To Field_789
Field_456 Link To Field_456
Save the PLD and see the Print Preview.
Regards,
Madhan.
Maybe you are looking for
-
Itunes failed to start because 3ivx.dll was not found
I cannot launch itunes on my computer. When I try to open it a window pops up that reads "Quick Time handler window: itunes.exe - unable to locate component". The message reads: "This application has failed to start because 3ivx.dll was not found. Re
-
PKUNRE field not getting populated in 2LIS_13_VDITM after ECC upgrade
Hi, We are seeing blank values for PKUNRE / 0BILLTOPARTY during extraction from 2LIS_13_VDITM. We are experiencing this issue after ECC upgrade which went live recently. We have applied note 580694 to correct missing fields in the billing extractor.
-
Show Multiple Filter Values in a Web Template
Hello I have a Web Template based on a query. On this Web Template I can set multiple single filter values for one characteristic. Now I want to show these filtered values for this characteristic on the web item. This is possible for ONE filter value
-
My iphone does not appear in itunes when connected to my computer
When I plug in my iphone to my computer it is not appearing in itunes. I can see in my computer that the phone is connected and photos can be browsed through MyComputer so the cable is making the connection. any ideas?
-
Need help in performance tunning
Hi , i have one update statement , where it is keep on running for hours and the volume of the data is 2.2 million version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Produc