Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Mixing Perl and SQL

by mje (Deacon)
on Nov 04, 2009 at 17:11 UTC ( #804994=note: print w/ replies, xml ) Need Help??


in reply to Mixing Perl and SQL

This does not strictly answer your question but it works well for us and you might find it useful. The ONLY SQL we have in our application is:

begin synonym.proc_name(?, ? ....); end; begin ? := synonym.func_name(?, ?, ...); end;

All the SQL is in procedures and functions in the database - including those that simply return a result-set. This allows us to keep all the logic in the database. Of course you can only do this if your DBD and database supports procedures and the returning of reference cursors which DBD::Oracle and Oracle does.


Comment on Re: Mixing Perl and SQL
Download Code
Re^2: Mixing Perl and SQL
by toma (Vicar) on Nov 04, 2009 at 21:04 UTC
    My code has to create the whole database from scratch, so I would need to include the SQL code that creates the stored procedures, and therefore I think I would be left with the same mixed-language issue.

    For example, one of my programs first uses modules to transform the input data from several formats into flat files. Then it uses modules that include the SQL to:

    1. Create an empty database with tables and views.
    2. Load the data from flat files.
    3. Transform the data into another set of tables that use a different indexing scheme.
    4. Query the data to generate a report.

    It should work perfectly the first time! - toma

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://804994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-08-23 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls