Skip to content

Error in executing factorial part of listing 5-3  #35

@aman-313

Description

@aman-313

Having trouble with data, code, or exercises in Practical SQL? I'm glad to help. Please answer these questions, and I'll typically reply within one to two business days.

Please include the chapter number in your issue title. For example: "Chapter 13: Regular Expression Question"

General

Please answer all of these as they're essential for troubleshooting.

What's your operating system (e.g. Windows 10, macOS Catalina, Ubuntu, etc.)?
Windows 10

Did you install PostgreSQL and pgAdmin according to the steps on page xxviii of the book's Introduction? If not, please describe your installation.
Yes

Which versions of PostgreSQL and pgAdmin 4 are you using? If you aren't sure, for PostgreSQL run the SQL command SELECT version(); and for pgAdmin 4, navigate to "About pgAdmin 4" under the "Help" menu.
PostgreSQL = 14
pgAdmin 4 = 6.1

Did you download the book's code examples and data from GitHub using the directions on page xxvii of the Introduction? If not, please describe how you loaded the material on your computer.

Issue or Question

Chapter, page and code listing number:
Chapter 5, listing 5-3

Describe the issue or your question:
Code mentioned in book for calculating factorial of a number is not executing successfully. It is showing an error at the end of the syntax. However, for this I am able to use inbulit factorial function. SELECT FACTORIAL(4);

Please paste the code and error message here. It's OK to alter identifying info such as a folder name
SELECT 4 !; -- factorial
D

ERROR: syntax error at or near ";"
LINE 1: SELECT 4 !; -- factorial
^
SQL state: 42601
Character: 11

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions