Database.ca SQL Server Blog

My Blog

Monday, February 10 2014

Keywords: Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

Version control of Oracle Databases in TFS or any other source code management app. Part 3 of 5

The blog is part of a series on Oracle Database Development with Visual Studio.
Read Part 1 of series here.
Read Part 2 of series here.
Read Part 4 of series here.
Read Part 5 of series here.
 
And now we are going to learn how to add new objects to our database. Let's start by adding a new stored procedure.

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

24) In Solution Explorer, right-click on Procedures folder, and select "Add New Item..."

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

25) Wow! Now that is exciting! You can choose most (but not all) Oracle object types in Visual Studio. And each will be placed in its own sub-folder and will be subject to versioning. Select "Stored Procedure" from the list, and give it a name and create the file.

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

26) The newly created procedure is now displayed in Solution Explorer but it is not in Server Explorer...that is normal...as Server Explorer is representing the reality of what exists in the Oracle Server, and Solution Explorer is representing what exists in your project.

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

27) Double Click on the new stored procedure in Solution Explorer. Write a simple yet valid procedure so that it would compile with no errors or warnings. If you are new to PL/SQL, open up an existing stored procedure in this project and copy and paste the content in this window, but just make sure you name it back to the new name. Save the script file and close it.

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

28) To actually migrate the newly created stored procedure from Visual Studio onto the server: in Solution Explorer right-click the new stored procedure and select Run.
 
The new stored procedure will now be displayed in Server Explorer. Meaning it is actually in the Oracle database.

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

29) Your should now add the Oracle project's source code into TFS or any other version control software of your choice. You can do so in a variety of ways. That also depends on whether you had already added your existing solution to TFS or not...any ways one easy way to add your project to TFS would be by right-clicking on the project name in Solution Explorer and selecting "Add solution to Source Control...".

 

Oracle Projects, Visual Studio 2010, 2012, 2013, Debug Oracle Stored Procedures in VS, Oracle 11g, Oracle 12g, Oracle 12c

Read Part 1 of series here.
Read Part 2 of series here.
Read Part 4 of series here.
Read Part 5 of series here.

 

 

 

Written by Ramin Haghighat