Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Interpolating subroutine call in SQL INSERT INTO SELECT statement

by 1nickt (Canon)
on Aug 26, 2015 at 11:46 UTC ( [id://1140005]=note: print w/replies, xml ) Need Help??


in reply to Interpolating subroutine call in SQL INSERT INTO SELECT statement

I agree with Anonymous Monk that there is nothing wrong with using two SQL statements in this situation. But what is the function of the subroutine to which you want to pass the value of COLUMN3 ? Could you use an existing SQL function in your SELECT query? Or could you build a stored routine for your DB?

Built-in SQL functions
Stored routines in MySQL

The way forward always starts with a minimal test.
  • Comment on Re: Interpolating subroutine call in SQL INSERT INTO SELECT statement
  • Download Code

Replies are listed 'Best First'.
Re^2: Interpolating subroutine call in SQL INSERT INTO SELECT statement
by shadowsong (Pilgrim) on Aug 26, 2015 at 14:30 UTC
    But what is the function of the subroutine to which you want to pass the value of COLUMN3 ? Could you use an existing SQL function in your SELECT query? Or could you build a stored routine for your DB?

    It did not even cross my mind to attempt either using an existing SQL function or building a stored routine within my DB and using that.

    I have written a Perl function that takes a string and substitutes out certain characters from that string (the characters I'm taking out belong to a hash that I can extend as and when I need to

    I'm not sure whether I can use an existing SQL function to achieve this, but it seemed like a good idea to have that function coded in Perl - seeing as how great Perl is with RegExps and the other programmer likely to be maintaining the code knows Perl..

    Thanks for the advice! Once I get a handle on creating stored procedures in MSSQL I'm sure I'll be looking for every excuse to use them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-25 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found