Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

In order to be more precise.

What is the definition of Statement, Function, Clause? How can I distinguish them?

For my understanding Statements are the standard SQL Statements (select, insert, update, delete, create, drop, truncate...) and clauses are like switches for those statements (like ON EXISTING UPDATE).

Functions could be standard SQL Functions (aggregate, string, datatype conversion....), or could be Sybase specific system procedures, but here what is the difference between procedures starting with xp or with sa or with sp

Could you please correct me?

asked 23 Mar '20, 04:35

Baron's gravatar image

Baron
2.2k144153181
accept rate: 48%


Here's my point of view:

  • A statement is the basic command that can be sent on its own to the database engine. All statements are listed as such in the docs sop they are clearly defined.

  • Many statements consist of several building blocks called clauses - some are optional (like the WHERE, GROUP BY or ORDER BY clauses in a SELECT statement), others are mandatory (the SELECT-list clause itself e.g.), so they are not necessarily switches. Not all statements are made up of several clauses, say a COMMIT statement has only one building block. I don't know whether that is technically also called a clause or not, but I'm sure one would not use that term here.

  • As you state, functions can relate to different things, related to the SQL standard or to vendor-specific builtin function, or to user defined functions (UDFs or stored functions created via CREATE FUNCTION). Sometimes functions and procedures are treated together, and they are contained in the same system table...). I guess the different prefixes of the builtin system functions and procedures have to do with the fact whether they are truly SQL Anywhere-specific (often named as "sa_") or shared with other SQL dialects like ASE/MS SQL (often "sp_" or "xp_" for extented procedures) but that's primarily my own guess.

permanent link

answered 23 Mar '20, 05:46

Volker%20Barth's gravatar image

Volker Barth
40.5k365556827
accept rate: 34%

edited 23 Mar '20, 05:47

2

Volker is pretty much spot on.

Re: or "xp_" for extented procedures

xp - external procedures (procedures that interact with the external world, like the command shell, mail, environment, etc.).

Statements generally fall into two categories, DDL - data definition language and DML - data manipulation language.

(24 Mar '20, 09:18) JBSchueler
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×6

question asked: 23 Mar '20, 04:35

question was seen: 1,072 times

last updated: 24 Mar '20, 09:20