Oracle Pro Tips, Trends & Technology eNewsletter Pinnacle Publishing http://www.pinnaclepublishing.com Issue 2.4 March 1, 2001 TABLE OF CONTENTS 1) Pop Quiz 2) This Issue's URLs 3) PL/SQL Programming Standards: Your Feedback 4) Oracle's Strategy for Java 5) Answer to the Pop Quiz --------------------------------------------------------- 1) POP QUIZ (answer at the end) --------------------------------------------------------- Q1. What's the minimum number of datafiles required for a tablespace? Q2. What's the minimum number of tables that can exist on a tablespace? Q3. What's the default tablespace of an index if none is explicitly specified at index creation time? --------------------------------------------------------- 2) THIS ISSUE'S URLs --------------------------------------------------------- This might not the best time to seek venture funding for your great idea. However, if you feel that you have the "next big thing" and are ready to take the next step in pursuing your idea, Oracle has an answer for you -- as always! :) Oracle has a free online community for entrepreneurs to turn their ideas into business opportunities. Benefits include applications to create a business plan, a list of firms providing products and services for emerging technology startups, access to select investors who will review and potentially finance winning business ideas, and more. For more information, go to http://www.oracle.com/ebusinessnetwork/webstyle.html and click on Venture Network. Other resource sites for entrepreneurs include: * PriceWaterhouseCoopers: http://www.pwcerc.com/first.asp * Ernst & Young: http://www.ey.com/global/gcr.nsf/US/Library_-_Entrepreneurial_Practice_-_Ernst_&_Young_LLP --------------------------------------------------------- 3) PL/SQL PROGRAMMING STANDARDS: Your Feedback --------------------------------------------------------- Since I'm getting a lot of feedback from you regarding my proposed standards, I'll use this issue and probably the next one to answer some of your questions first, before I publish more standards. One reader raised the question of why we write database packages instead of standalone stored procedures and functions. Database packages offer a number of advantages: 1) Encapsulation Database packages allow you to group related procedures, functions, and variables into a logical unit. 2) Information hiding You can categorize your package procedures and functions into public and private modules. Ones that only exist in the package body are known as private routines and can only be referenced by other routines within the same package. 3) Session variables Package variables defined in the package specification persist until you terminate your database session. This allows you to make use of these variables to store session-related information -- for instance, session ID, summary information, and so on. 4) Performance The entire database package is loaded into memory when you invoke any one of its members. This implies that invoking other members of the same package will give you better performance. 5) Ease of administration If you wish to grant the EXECUTE privilege to another user, you can simply grant it on the package, and all public routines of the package will become available. On the other hand, standalone stored procedures and functions will have to be granted individually. 6) Compilation The routines that reference the package will compile as long as the package specification is defined, even though there might be compilation errors in the package body. This is especially useful for large project teams. The front-end and back-end developers can work somewhat independently during code development as long as they've agreed on the package specifications. The back-end developers can continue to develop and debug the package body without affecting the front-end team. Let me know if you think of other advantages/ disadvantages. --------------------------------------------------------- 4) ORACLE'S STRATEGY FOR JAVA --------------------------------------------------------- Unless you've just arrived from another planet, you've probably heard of the Java programming language. You also might have noticed that Java has become a key technology in Oracle's Internet Computing strategy. So, why Java? And why should you care? To try to answer these questions, I've decided to draw on the expertise of my colleague at Procase, Jim Skehill. Jim has in-depth knowledge of using Oracle's Java tools to build Internet applications for our clients. In the next few issues of the Oracle Pro eXTRA, Jim will contribute articles on Oracle and Java. Starting with basic Java terminology, Jim will gradually explore more advanced topics of Oracle's implementation such as JDeveloper and BC4J. Jim's biography: Jim has a BSc in Computer Science from the University of Toronto, Canada. He's been programming in C/C++ for 11 years and in Java for four years, mostly in the financial services field. You can reach him at mailto:JSkehill@ProcaseConsulting.com. * * * * * Java is a general-purpose programming language that's very similar to C++. Java code compiles to "byte code" that runs on a Java Virtual Machine, or JVM, which translates the byte code to actual machine instructions at runtime. Because of this indirection, the same compiled code can run on any platform for which a JVM exists. And currently they exist for just about any platform in common usage, from Cray supercomputers to Palm Pilots. The fact that it can run just about anywhere, coupled with the current trend toward distributed systems, has made Java the programming language of choice for Web- based development. And that's why Oracle has adopted Java as a key technology in it's fight for supremacy in the application server marketplace. Currently, Oracle iAS (Internet Application Server) comes with not one but two JVMs -- one inside and one outside the database. What's more, PL/SQL can call Java and vice versa. But if you know PL/SQL, why bother to learn Java? I can think of three reasons: 1) It's easier to write distributed systems in Java. PL/SQL has to run either in the database or in iAS on MOD_PLSQL. On the other hand, Java can run almost anywhere -- inside the database, outside in iAS, on another JVM somewhere on the network, even in a Web browser on a client machine. The choice is yours. And, of course, distributed systems are easier to scale. 2) Unlike PL/SQL, Java is a general-purpose language. So having access to Java from PL/SQL automatically gives you access to a vast toolset, and that toolset grows larger every day. XML, 2D and 3D Graphics, Speech Recognition, Telephony -- you name it and there's probably a Java API (Application Programming Interface) to help you get the job done. 3) Because Java is general-purpose and widely used, Java programming skills aren't hard to come across. If you're a project manager and are finding PL/SQL skills hard to come by, you might want to consider implemented parts of your project in Java. If you're a developer, you might want to learn Java as a valuable addition to your skill set. In the next issue, I'll talk about Oracle's Java Development Tools. --------------------------------------------------------- 5) ANSWER TO THE POP QUIZ --------------------------------------------------------- Q1. What's the minimum number of datafiles required for a tablespace? Ans. A tablespace must have at least one corresponding datafile. Q2. What's the minimum number of tables that can exist on a tablespace? Ans. Zero. In this scenario, space is allocated to Oracle as a result of the creation of the tablespace, but none of that has to be used. Q3. What's the default tablespace of an index if none is explicitly specified at index creation time? Ans. The default tablespace is associated with the database user issuing the table creation command. You can issue the following query to obtain this information: SQL> select * from user_users; A newly created database user account has a default tablespace of SYSTEM. --------------------------------------------------------- Well, that's it for this week. I welcome your feedback, input, tips, suggestions, Web sites, and other Oracle- related news. If you send me something, please let me know whether I can use your name with your comments. I apologize in advance if I don't respond personally to each of your questions or suggestions, but I'll get to as many as I can in the eNewsletter if not personally. Garry Chan, Editor Database Architect mailto:GChan@ProcaseConsulting.com This eNewsletter is brought to you compliments of Pinnacle Publishing, Inc. Copyright(c) 2001 http://www.pinnaclepublishing.com All rights reserved.