my $stmt = "with recursive Fibonacci(n, a, b) AS (
SELECT 0, 0, 1
UNION ALL
SELECT n+1, b, a+b
FROM Fibonacci
WHERE n < 10
)
SELECT * FROM Fibonacci";
my $sth = $dbh->prepare($stmt);
my $rv = $sth->execute() or die $DBI::errstr;
the query works well at sqlite3 version: 3.45.2 but when I use it in Perl script, it shows “prepare failed: near “with”: syntax error” message.
New contributor
bd64 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.