DEV Community

Judy
Judy

Posted on

2 1 1 1 1

Getting positions of members according to primary key values #eg58

In the following product category table, ID field is the primary key. The task is to find ordinal number of the member whose ID field value is 5.

Image description

SPL script:

Image description

A1 Connect to the database;
A2 Retrieve Category table from the database and set ID as the primary key;
A3 Find ordinal number of the record whose primary key value is 5. If the desired primary key value does not exist or no primary key is defined, pfind() function returns 0.

SPL open source address

Download

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay