Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-12 Thread Mike Eggleston
Thanks. I didn't think of "CTEs" either. I need to read up on them. Mike > On Sep 12, 2016, at 08:49, Dominique Devienne wrote: > >> On Sun, Sep 11, 2016 at 11:48 PM, mikeegg1 wrote: >> >> I think Oracle (a long distant memory) has variables like

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-12 Thread Mike Eggleston
Duh. What a brilliant idea. Wish I had thought of it. :) Thanks. Mike > On Sep 12, 2016, at 08:02, David Bicking wrote: > > Sqlite doesn't have variable. While last row id is available other ways, a > trick to emulate a variable is to create a temp table with one field.

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-12 Thread Dominique Devienne
On Sun, Sep 11, 2016 at 11:48 PM, mikeegg1 wrote: > I think Oracle (a long distant memory) has variables like @variable or > @@variable. Not really. Oracle SQL doesn't have variables per se. But APIs to interact with Oracle SQL (OCI, JDBC, ODBC, etc...) can *bind* and

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-12 Thread David Bicking
Sqlite doesn't have variable.  While last row id is available other ways, a trick to emulate a variable is to create a temp table with one field. You put the value in to the that field. You can then cross join with the rest of your table as need be, or do a sub-select to value a SET command.

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-11 Thread Darren Duncan
You can also access that value within your Perl code, in a DBMS-agnostic fashion, with the appropriate DBI routine: http://search.cpan.org/dist/DBI/DBI.pm#last_insert_id -- Darren Duncan On 2016-09-11 2:59 PM, mikeegg1 wrote: I forgot I could use it inside the shell. Thanks. On Sep 11,

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-11 Thread mikeegg1
I forgot I could use it inside the shell. Thanks. Mike > On Sep 11, 2016, at 16:58, Simon Slavin wrote: > > > On 11 Sep 2016, at 10:53pm, mikeegg1 wrote: > >> Thanks. I thought not. I’m doing this from PERL on a Mac and don’t know if I >> can fully

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-11 Thread Simon Slavin
On 11 Sep 2016, at 10:53pm, mikeegg1 wrote: > Thanks. I thought not. I’m doing this from PERL on a Mac and don’t know if I > can fully access last_row_id(). It's not a C function, it's a function you can use inside SQL commands. There shouldn't be a problem with it.

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-11 Thread mikeegg1
Thanks. I thought not. I’m doing this from PERL on a Mac and don’t know if I can fully access last_row_id(). :) Mike > On Sep 11, 2016, at 16:52, Simon Slavin wrote: > > > On 11 Sep 2016, at 10:48pm, mikeegg1 wrote: > >> I think Oracle (a long

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-11 Thread Simon Slavin
On 11 Sep 2016, at 10:48pm, mikeegg1 wrote: > I think Oracle (a long distant memory) has variables like @variable or > @@variable where you can do something like '@variable = select rowid from > table where field = 4' and then later do 'insert into othertable (field2) >