Archive for the ‘language’ Category

PL/JSON v0.6 Released to SourceForge

From the Database Geek.

PL/JSON v0.6.1 has now been released to Sourceforge.net. The reason for the .1 is that I forgot a dependency on the 0.6 release.

Anyway, PL/JSON can now create JSON via the API or through parsing a text string. The parser is implemented as a stand along package. That means you can write your own parser (or use an external procedure) if you don’t like mine. This will make it very extensible. I also plan to add PL/SQL callbacks to the parser at some point for custom processing.

Example of parsing:

SET SERVEROUTPUT ON

DECLARE
  v_json json;
  v_json2 VARCHAR2(32000) :=
   '{
      "abc": "dpkxvdvvcxz\"vxasasa   ",
      "def": 12345,
      "ghi":{"isit":true, "nope":false,"denada":true },
      "jkl": [1234, 45678.99, 121211, 21323232, 00000]
   }';
BEGIN

  v_json := json(v_json2);
  v_json.print;
END;
/

{
"abc":"dpkxvdvvcxz\"vxasasa   ",
"def":12345,
"ghi":{
"isit":true,
"nope":false,
"denada":true}
,
"jkl":[1234,45678.99,121211,21323232,0]}

Output from PL/JSON checks out on JSONLint.

Click to continue reading “PL/JSON v0.6 Released to SourceForge”

Read the rest of this entry »

Comment by vijay on What is the difference between Oracle, SQL and PL/SQL?

thnx

!***! Entry Link:http://it.toolbox.com/blogs/oracle-guide/what-is-the-difference-between-oracle-sql-and-plsql-9602!***!

Click to continue reading “Comment by vijay on What is the difference between Oracle, SQL and PL/SQL?”

Read the rest of this entry »

Comment by Vikramasimha on What is the difference between Oracle, SQL and PL/SQL?

Hi Sir,

Firsttime i am vising your site, i am very happy to c you, and happy to get more information on SQL as well as PL/SQL.

Sir, the information you have provided is more understandable, and we still hoping the same Sir, thank you.

Regards,

Vikramasimha

!***! Entry Link:http://it.toolbox.com/blogs/oracle-guide/what-is-the-difference-between-oracle-sql-and-plsql-96

Click to continue reading “Comment by Vikramasimha on What is the difference between Oracle, SQL and PL/SQL?”

Read the rest of this entry »

Comment by LewisC on What is the difference between Oracle, SQL and PL/SQL?

suvro,

If you just want to learn database management from a Java perspective, there is no reason to learn PL/SQL. However, if you want to learn database management from an oracle perspective, you must learn pl/sql. It really depends on what you want to do, code for databases, or code for Oracle.

Even though Oracle supports java in the datavase, PL/SQL gives you so much more control that I would say it is mandantory for anyone who truly wants to be an oracle expert.

T

Click to continue reading “Comment by LewisC on What is the difference between Oracle, SQL and PL/SQL?”

Read the rest of this entry »

Comment by suvro on What is the difference between Oracle, SQL and PL/SQL?

hi Lewis,

i read your articles n it gave me a nice precise idea about oracle,sql n pl/sql.currently i’m doing my engineering n i know java well.right now i want to learn database management skills.but i have the following questions in my mind.hope u can help.

1.as java n pl/sql are so similar in nature, can i use my java knowledge through oracle for learning database management?

2.will it better than learning pl/sql in anyway?

3.n if yes then what exactly do i need to learn?
<b

Click to continue reading “Comment by suvro on What is the difference between Oracle, SQL and PL/SQL?”

Read the rest of this entry »

Comment by Vishakha Jain Agrawal on What is the difference between Oracle, SQL and PL/SQL?

Hello Sir,

I read your article and feedbacks.

I know the difference char, varchar and varchar2.

But be practical I understood first time with the help of Length() function.

Your explanation procedure is good and helpful.

Thanks sir

!***! Entry Link: What is the difference between Oracle, SQL and PL/SQL?!***!

Click to continue reading “Comment by Vishakha Jain Agrawal on What is the difference between Oracle, SQL and PL/SQL?”

Read the rest of this entry »

Programming Postgres

This is just a quick overview of the availability of programming for Postgres. With Oracle, your choice in the database is Java or PL/SQL. In general, PL/SQL is the preferred language.
One of the things that attracted me to Postgres was the ability to choose one of many languages to program in. I usually choose PL/pgSQL but if I can’t do something with that, it’s nice to be able to fall back to TCL, Perl or one of the many other languages supported by Postgres.
Here is a (incomplete, I’m sure) list of supported languages:

  • PL/pgSQL – Standard Procedural Language for Postgres
  • PL/TCL – TCL, Tool Command Language, easy to learn but powerful
  • PL/Perl – Practical Extraction and Report Language, has grown way beyond its origins
  • PL/Java – Java, meh
  • PL/PHP – PHP: Hypertext Preprocessor, over hyped language
  • PL/Python – Object Oriented, dynamic language.

Click to continue reading “Programming Postgres”

Read the rest of this entry »

Oracle Objects, Types and Collections: Part 3

In Part 1 of this series, we talked about how Oracle objects compare to Java and how to create Oracle Objects. In Part 2, I covered we covered object comparison and type inheritance. Today, we’ll talk about polymorphism and type evolution.

Like parts 1 and 2, this will be a technical discussion.

Polymorphism

First a definition. What is Polymorphism and why is it important? One of the best definitions I have found is this link at OnJava. You can skip the part about object serialization. Not really that important to Oracle’s OO as you’re already in the database.

Let’s go back to our (most basic) calculator example.

CREATE OR REPLACE TYPE Calculator AS OBJECT (
  value NUMBER,
  MEMBER PROCEDURE print,
  MEMBER PROCEDURE add1( p_amt IN NUMBER ),
  MEMBER PROCEDURE subtract( p_amt IN NUMBER )
  )
  NOT FINAL;
/

CREATE OR REPLACE TYPE BODY Calculator AS
  MEMBER PROCEDURE print IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE( TO_CHAR( value ) );
  END;

  MEMBER PROCEDURE add1( p_amt IN NUMBER )  IS
  BEGIN
    value := value + p_amt;
  END;

  MEMBER PROCEDURE subtract( p_amt IN NUMBER )  IS
  BEGIN
    value := value - p_amt;
  END;

END;
/

And our Advanced Calculator:

CREATE OR REPLACE TYPE AdvancedCalculator UNDER Calculator (
  pi FLOAT,
  CONSTRUCTOR FUNCTION AdvancedCalculator
     RETURN SELF AS RESULT ,
  MEMBER PROCEDURE multiply( p_amt IN NUMBER ),
  MEMBER PROCEDURE divide( p_amt IN NUMBER ),
  OVERRIDING MEMBER PROCEDURE print
   )
NOT FINAL;
/

This isn’t exactly the same AdvancedCalculator.

Click to continue reading “Oracle Objects, Types and Collections: Part 3″

Read the rest of this entry »

Oracle Objects, Types and Collections: Part 2

This is a continuation of Object Orientation in Oracle. I guess I should have called it the Sorcerer of OOO. This is a technical entry.

Anyway, in part 1 I covered the basics of creating an Oracle object type and showing how it compared to a Java class. Today I’m going to cover the concepts of comparing objects and Inheritance. In part 3, I will cover type evolution and Polymorphism and in part 4 I will cover Object Views and Object Tables.

Comparing Objects

Many times, you will be working with multiple instances of the same object.

Click to continue reading “Oracle Objects, Types and Collections: Part 2″

Read the rest of this entry »

Oracle Objects, Types and Collections: Part 1

I could have called this OO In Oracle: A Techie’s View. But the Sorcerer of OO is a much cooler title. ;-) You have to pronounce OO as ooh! as in Ooh and Aah!

What is OO? OO stands for Object Oriented. OOD is OO Design, OOA is OO Analysis and OOP is Object Oriented Programming. Oracle is an ORDBMS, an Object Relational Database Management System. In this article, I am going to present a sample java class and show how you would implement the same class in Oracle. This is a technical article comparing Oracle objects with Java.

Click to continue reading “Oracle Objects, Types and Collections: Part 1″

Read the rest of this entry »