Rechercher

Article
· Août 12 7m de lecture

Using LIKE with Variables and Patterns in SQL

Over the years, I’ve noticed that certain SQL questions come up repeatedly on the InterSystems Developer Community, especially about using the LIKE predicate in different contexts. Common variations include:

and many more derivatives. So, I decided to write an article that focuses on how LIKE works in InterSystems IRIS SQL, especially when used with variables in Embedded SQL, Dynamic SQL, and Class Queries, while touching on pattern escaping and special character searches.

First of all, I'd like to mention that InterSystems IRIS SQL offers most of the capabilities available in other relational DBMS that implement a later version of the SQL standard. But at the same time, it's important to mention that apart from relational access, in IRIS you can also use other models to get the same data, for example, object or document models. 

On this note, let's look at the LIKE predicate and how this tool is used in SQL for pattern matching. 

Basic info

Firstly, let's look at some basics. The LIKE predicate is used in a WHERE (or HAVING) clause of a SELECT, UPDATE, or DELETE statement to filter records based on whether a column's values match a specified pattern. The basic syntax is as follows:

SELECT column1, column2
  FROM table_name
 WHERE column_name LIKE pattern;

The pattern can include literal characters and two primary wildcard characters:

  • % (percent sign): represents zero, one, or multiple characters. For example, 'A%' matches any string starting with 'A', '%Z' matches any string ending with 'Z', and '%XY%' matches any string containing 'XY'.
  • _ (underscore): represents a single character. For example, 'A_C' matches 'ABC', 'AEC', etc., but not 'AC' or 'ABBC'.

For example, the following query retrieves all names from the Employees table that start with "Jo":

SELECT Name
  FROM Employees
 WHERE Name LIKE 'Jo%';

And this query retrieves all names that have an "a" as the second character:

SELECT Name
  FROM Employees
 WHERE Name LIKE '_a%';

It's crucial to understand that LIKE performs pattern matching, not equality. While 'ABC' LIKE 'ABC' evaluates to true, it's generally more efficient to use the = operator for exact string matches ('ABC' = 'ABC'). LIKE excels when you need fuzzy matching or searches for substrings.

Include a special character in a search phrase (escape clause)

I find the ESCAPE clause to be quite handy when you need to use a wildcard character, e.g. %, in your LIKE statement, and want it actually to mean a percentage sign. In this case, you can use the ESCAPE clause to define an escape character. Any character immediately following the escape character in the pattern is treated as a literal character, not a wildcard. For example, if you have the following data:

INSERT INTO Post.Promos(name, description) VALUES('Test 1', 'This is 40% discount')
INSERT INTO Post.Promos(name, description) VALUES('Test 2', 'This is 50% discount')
INSERT INTO Post.Promos(name, description) VALUES('Test 3', 'This is 10% discount')
INSERT INTO Post.Promos(name, description) VALUES('Test 4', 'some description')

and you wish to find all Promos that have a "50% discount" phrase in the description, you can use the following query:

SELECT Name
  FROM Post.Promos
 WHERE Description LIKE '%50\% discount' ESCAPE '\'

In this example, \ is defined as the escape character, so the system will treat the % sign as a literal, not a wildcard, and will look for a discount with a description that contains the literal phrase "50% discount".

Find special characters

If you need to look for several special characters or to find all of them in a string, you can't use a LIKE predicate, you need to use %MATCHES. It matches a value with a pattern string containing literals, wildcards, and ranges. Beware that a pattern should be specified in Logical format, regardless of the %SelectMode setting. So if you want to find all values that contain any special character, you can use %MATCHES to look for them like this:

SELECT * 
  FROM Post.Promos p
 WHERE p.description %MATCHES '*[!”%#$&”()*+,-./:;<=>?@\%\_]*'

This finds any description containing at least one of the listed symbols. You can use the ESCAPE clause to specify the escape character, but by default it's set to "\", so you can omit it as is done in my example. 

The query above will return three rows with 40%, 50% and 10% discount and not 'some description'.

Also, this predicate follows the general rules of pattern matching of IRIS. For example, for a placeholder, you will use "?" and not "_":

SELECT * 
  FROM Post.Promos p
 WHERE p.name %MATCHES '???? [0-9]'

This will look for all names that consist of any four characters, a space, and a numerical digit.

While I'm on the topic of patterns, there's also a predicate %PATTERN that allows you to match a pattern of character type codes and literals to the data values. So, to perform the same search as above, you can write the following query:

SELECT * 
  FROM Post.Promos p
 WHERE p.name %PATTERN '1U.L1" "1N'

This matches:

1U — 1 uppercase letter
.L — lowercase letters
1" " — 1 space
1N — 1 numerical digit

Using variables with LIKE

Now it's time to look at how you can use variables in your queries. There are three ways you can use a SQL statement in your Object Script code: Embedded SQL, Dynamic SQL, and writing a class query.

Embedded SQL

To pass a value into an Embedded SQL statement, you should use a named parameter (or, in other terms, input and/or output host variables), meaning that it has to have a name. For example, if we still wish to find all Promos with a 50% discount, we will write the following query:

 set param = "50\% discount"
 &sql(DECLARE C1 CURSOR FOR
       SELECT Name
         INTO :nameout
         FROM Post.Promos
        WHERE Description LIKE '%'_:param_'%' ESCAPE '\')
 &sql(OPEN C1)
       QUIT:(SQLCODE'=0)
 &sql(FETCH C1)
 WHILE (SQLCODE = 0) {
     WRITE nameout,!
    &sql(FETCH C1) }
  &sql(CLOSE C1)

Its input host variable is param, and it equals "50% discount". To make the query understand that % is a part of the parameter and not a placeholder for any length of characters, I use the ESCAPE clause.

Also, don't misplace double and single quotation marks:

  • In SQL, you use the former to mark a field that is a reserved name, for example, "Group". You use the latter to observe any string.
  • In ObjectScript, you use the former to observe the string, and the latter has nothing to do with strings at all, it's an unary operator NOT.

When using parameters, you don't need to put a single quotation mark inside the double quotation mark

set param = " '50\% discount ' " 

to show the compiler that it's a string or anything to this effect. In this case, the engine will look for single quotes as part of the search string,

The output host variable in the example above is "nameout," where the value of the Name column will be placed, and it can be used later in the code.

Dynamic SQL

Starting with version 2015.2, Dynamic SQL can accept a literal value input to a query in two ways:

  • input parameters specified at execution time using the “?” character
  • input host variables specified at prepare time

The second approach will follow the same idea as in Embedded SQL above:

 set param = "50\% discount"
 set myquery = 3
 set tStatement = ##class(%SQL.Statement).%New()
 set myquery(1) = "SELECT Name"
 set myquery(2) = "FROM Post.Promos"
 set myquery(3) = "WHERE Description LIKE '%'_:param_'%' ESCAPE '\'"
 set qStatus = tStatement.%Prepare(.myquery)
 set tResult = tStatement.%Execute()
 while tResult.%Next() {
	 write tResult.Name, !
 }

with the exception that you don't need the output host variables because the %SQL.StatementResult (result type of tStatement.%Execute()) will have all the properties that reference columns in the SELECT statement.

In the first approach, you put the question mark in place of a parameter, and then when calling %Execute(), you need to provide values for the parameters in the same order as the "?" in your statement:

 set param = "50\% discount"
 set myquery = 3
 set tStatement = ##class(%SQL.Statement).%New()
 set myquery(1) = "SELECT Name"
 set myquery(2) = "FROM Post.Promos"
 set myquery(3) = "WHERE Description LIKE '%'_?_'%' ESCAPE '\'"
 set qStatus = tStatement.%Prepare(.myquery)
 set tResult = tStatement.%Execute(param)
 while tResult.%Next() {
	 write tResult.Name, !
 }

Class Query

The input host variables are used in Class Queries following the same rules as in Embedded and Dynamic SQL:

Query GetDiscount(param As %String) As %SQLQuery [ SqlProc ]
{
SELECT Name FROM Post.Promos
 WHERE (Description LIKE '%'_:param_'%' ESCAPE '\')
}

When calling the query, you provide parameters in the same order as they are written in the method signature:

SELECT *
  FROM Post.Promos_GetDiscount('50\% discount')

I hope this article answers at least some of the popular questions that crop up from time to time.

If you're interested in a more in-depth article about performance considerations and best practices, or if you have any comments, don't hesitate to leave them in the comments section below.

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Annonce
· Août 12

[Video] App de Navegação como Orquestração de Serviços no HealthShare com Single Sign-On para aplicativos de terceiros

Olá Comunidade,

Aproveitem o novo video no InterSystems Developers YouTube:

⏯ HealthShares Nav App as a Service Orchestrator with Single SignOn for 3rd Party Apps @ Global Summit 2024

Este vídeo apresenta a história de um cliente da região de Mayenne, na França, onde o Health Share é usado como uma plataforma unificada para coordenar o atendimento em sete hospitais e provedores municipais para 300.000 pacientes. Ele destaca como o Health Share integra serviços de terceiros com autenticação e autorização integradas, permitindo acesso fácil para diferentes profissionais de saúde por meio de login único e diversos métodos de login seguros.

Apresentadores:
🗣 @Florence Cureau, Sales Engineer, InterSystems 
🗣 @Francois Le Floch , Senior Solutions Engineer, InterSystems

Registe-se em nosso canal no YouTube InterSystems Developers para ficar atualizado!

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Août 12

NFC Digital Business Card in Pakistan

What is an NFC Digital Business Card?

An NFC digital business card is a modern networking tool that allows you to share your contact details instantly by simply tapping your card on a smartphone. Unlike traditional paper cards, this card uses Near Field Communication (NFC) technology to transfer data, making it a paperless business card in Pakistan.

History of Digital Business Cards

The rise of smart business cards started globally as professionals sought eco-friendly, tech-driven alternatives. Now, digital networking tools are becoming essential in Pakistan's digital transformation.


Why NFC Cards Are Gaining Popularity in Pakistan

With Pakistan experiencing a boom in digital business trends, professionals and startups are turning to contactless digital cards to:

  • Save printing costs
  • Make lasting first impressions
  • Integrate NFC tech for business

Benefits of NFC Digital Business Cards

Using an NFC digital business card in Pakistan comes with a wide range of advantages:

  • Instant Sharing: Tap and share your contact info in seconds.
  • Eco-Friendly: A great alternative to paper-based cards.
  • Reusable: No need to reprint when details change.
  • Interactive: Add links to social media, websites, or portfolios.
  • Professional Appeal: Impress clients with modern tech.

Eco-Friendly and Sustainability Impact

These business cards without paper support Pakistan’s green initiatives, making them an eco-friendly business card solution.


How NFC Business Cards Work

An NFC-enabled card contains a chip that stores your digital identity. When someone taps your card to their NFC-compatible device, it opens a link to your profile.

Steps to Use an NFC Card

  1. Order your custom NFC card Pakistan.
  2. Program your data (contact info, social links, etc.)
  3. Tap on any smartphone with NFC.

Which Smartphones Support NFC?

Most modern Android and iPhones (iPhone 7 and above) support NFC technology.

Learn more: How NFC Cards Work


NFC Business Card vs Traditional Business Card

Feature NFC Digital Card Traditional Card
Shareability Tap and connect instantly Hand over manually
Editability Easy to update Requires reprint
Eco-Friendliness 100% paperless Paper waste
Interactive Features Videos, social links None
Cost Over Time One-time investment Recurring printing

Top NFC Business Card Providers in Pakistan

Looking for the best NFC card in Pakistan? Here are top providers:

  • Profylio – Known for quality, custom design, and quick delivery.
  • NFC Pak – Offers NFC smart card Karachi and Islamabad services.
  • SmartTapPK – Specializes in touchless business cards.

Explore reviews: NFC Card Reviews Pakistan


NFC Business Card Price in Pakistan

The NFC business card price in Pakistan varies based on design and features:

  • Basic PVC Card: PKR 1,200 – PKR 2,000
  • Metal NFC Card: PKR 3,000 – PKR 5,000
  • Custom Designs: Starting from PKR 1,500

Check latest pricing: Profylio Shop


How to Create Your NFC Digital Business Card

Creating an NFC card is simple and fast:

  1. Visit Profylio’s Online NFC Card Builder
  2. Choose your design
  3. Add logo, profile link, and contact info
  4. Place your order and get it delivered

You can also track your order here: Track Order


Customization Options and Design Tips

NFC Card Design Ideas

  • Minimalist Design
  • Full Photo Cards
  • Branded with Company Colors

Tips for Impactful Design

  • Use high-resolution logo
  • Include LinkedIn or WhatsApp links
  • Highlight call-to-action (e.g., "Let’s Connect")

View samples: Profylio Gallery


Case Studies: Businesses Using NFC Cards in Pakistan

Freelancers

Graphic designers are using NFC cards to share portfolios instantly at events.

Startups

Startups in Lahore and Karachi use tap cards for professionals to stand out in pitch meetings.

Real Estate Agents

Using NFC cards to share Google Maps locations of properties.

Explore more use cases: Digital Networking Tools Blog


Challenges and Limitations

  • Not all phones support NFC
  • Dependence on device compatibility
  • Data privacy concerns

Security and Data Privacy

Use encryption and secure URLs. Learn more: Privacy Policy


The Future of Business Cards in Pakistan

As Pakistan embraces NFC smart solutions, expect to see:

  • Bulk NFC card orders for corporate teams
  • Integration with CRMs and analytics
  • NFC use in digital standees and signage

Stay updated: NFC Digital Standee


FAQs about NFC Digital Business Cards in Pakistan

1. What is an NFC digital business card?
It's a smart card that uses NFC tech to transfer contact info via tap.

2. How does an NFC business card work?
It uses a chip that triggers a URL or profile when tapped on a compatible device.

3. Is NFC card technology available in Pakistan?
Yes, companies like Profylio offer full services.

4. How much does an NFC card cost in Pakistan?
Starting from PKR 1,200 for basic models.

5. Are NFC cards better than traditional cards?
Yes, they are reusable, eco-friendly, and offer interactive features.

6. Can I use NFC cards on iPhone?
Yes, iPhones 7 and newer support NFC.

7. What data can I store on an NFC card?
Links to websites, social media, calendars, contact info, videos, portfolios, and more.

8. Can NFC cards be reused?
Yes, you can update the link or content.

9. Are NFC cards safe to use?
Yes, if you use secure platforms and encrypted links.

10. Where to buy NFC cards in Pakistan?
Visit Profylio or local providers in major cities.


Final Thoughts: Is It Time to Go NFC?

The NFC digital business card in Pakistan is more than a trend—it's a revolution in business networking. For freelancers, startups, and professionals, it's time to ditch the outdated paper card.

👉 Order Your NFC Digital Card Now – e.profylio


Tags:

NFC Digital Business Card In Pakistan, Smart Business Card Pakistan, NFC Visiting Card, Contactless Business Card, Paperless Business Card Pakistan, NFC Card Benefits For Startups, NFC Card Design Ideas, NFC Card Printing In Pakistan, Custom NFC Card Pakistan, NFC Smart Card Karachi


For more resources, visit:

Stay updated on smart branding tools with NFC digital cards in Pakistan today!

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Août 12

Leading AngularJS Web Development Company | Expert Angular Developers

Introduction

In today’s fast-paced digital market, businesses need applications that can keep up with evolving user demands and rapid technological changes. That’s why working with the Leading AngularJS Web Development Company | Expert Angular Developers is the smartest move for companies seeking high-quality, scalable, and future-ready web applications.

As an experienced AngularJS web development company, we specialize in building dynamic, interactive, and secure apps that deliver exceptional performance across all platforms. AngularJS, backed by Google, is one of the most trusted JavaScript frameworks for creating robust single-page applications (SPAs) that are easy to maintain and expand. In this guide, we’ll explore why AngularJS is a top choice, what sets a leading development company apart, and how expert Angular developers can help you achieve your business goals.


Why AngularJS is the Go-To Framework for Modern Web Development

AngularJS offers a powerful set of features that make it ideal for building sophisticated web applications:

  1. Two-Way Data Binding – Ensures that changes in the user interface automatically update the data model, and vice versa.
  2. Modular Architecture – Allows large projects to be divided into smaller, manageable components.
  3. Reusable Components – Saves development time and ensures design consistency.
  4. Dependency Injection – Improves code maintainability and makes testing easier.
  5. Active Community Support – Thousands of libraries, tutorials, and best practices available for developers.

Qualities of a Leading AngularJS Web Development Company

When you partner with the right team, you get more than just coding expertise. A leading AngularJS web development company offers:

  • Proven Industry Experience – A track record of successful AngularJS projects.
  • Specialized Angular Developers – Experts who understand the framework inside out.
  • Custom Solutions – Tailored apps that align perfectly with your business needs.
  • Strong Communication – Transparent project updates and collaborative decision-making.
  • Post-Launch Support – Continuous maintenance to keep your app optimized.

The Role of Expert Angular Developers

Expert developers bring more than just technical skills to the table:

  • Efficient Problem-Solving – Quickly identify and resolve bottlenecks.
  • Optimized Performance – Ensure apps run smoothly even under heavy traffic.
  • Security Best Practices – Protect user data with robust security measures.
  • Future-Proofing – Build apps with scalability in mind to adapt to evolving needs.

Our Development Process for High-Quality AngularJS Applications

To deliver the best possible results, we follow a structured process:

  1. Requirement Gathering – Understand client goals, audience, and technical needs.
  2. Architecture Design – Create a scalable foundation for long-term growth.
  3. UI/UX Design – Build engaging, user-friendly interfaces.
  4. Agile Development – Deliver incremental updates for continuous improvement.
  5. Testing & QA – Rigorously test for performance, security, and usability.
  6. Deployment & Maintenance – Launch the app smoothly and keep it updated.

Benefits of Partnering with a Leading AngularJS Web Development Company

  • Scalable Applications – Add features and handle more traffic with ease.
  • Faster Development Cycles – Reusable code speeds up delivery.
  • Cross-Platform Compatibility – Seamless performance on mobile and desktop.
  • Enhanced Security – Protection from common vulnerabilities like XSS and CSRF.
  • SEO-Friendly SPAs – Pre-rendering and other optimizations improve rankings.

Case Study: Building a High-Traffic eLearning Platform

Challenge: An eLearning startup needed a platform capable of streaming video, hosting quizzes, and managing thousands of concurrent users.
Solution: Our expert Angular developers built a modular architecture with dynamic content loading and caching strategies.
Result: The platform handled a 200% increase in user traffic without downtime and offered smooth, real-time performance.


How to Choose the Right AngularJS Development Partner

  • Check Past Work – Review portfolios and case studies.
  • Look for Specialized Teams – Ensure they have dedicated Angular experts.
  • Discuss Scalability Plans – Understand how they future-proof applications.
  • Evaluate Communication – Clear and transparent updates are key.
  • Ask About Support – Post-launch assistance is crucial for ongoing success.

Common Mistakes Businesses Make

  • Focusing Only on Price – Low-cost options may compromise quality.
  • Skipping Scalability Planning – Leads to expensive rebuilds later.
  • Neglecting UI/UX – A beautiful app is useless if it’s hard to navigate.

FAQs

Q1: What makes your company a leading AngularJS web development company?
We have years of experience, a portfolio of diverse projects, and a team of certified Angular experts.

Q2: How do expert Angular developers improve my project’s success?
They bring specialized knowledge, efficiency, and best practices to ensure quality and scalability.

Q3: Can AngularJS apps handle high-traffic situations?
Yes. With the right architecture, AngularJS can manage thousands of concurrent users seamlessly.

Q4: Is AngularJS still relevant for modern apps in 2025?
Absolutely. Many businesses still rely on AngularJS for its stability and scalability.

Q5: Do you offer post-launch support?
Yes, we provide maintenance, updates, and performance monitoring after launch.


Conclusion

Choosing the Leading AngularJS Web Development Company | Expert Angular Developers is a strategic decision that can determine your project’s success. With the right team, you get more than just a functional app — you get a scalable, secure, and high-performing solution that grows with your business. Whether you’re building a new product or upgrading an existing system, partnering with experienced AngularJS professionals ensures your application stays competitive in today’s digital landscape.


Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Annonce
· Août 12

The August Article Bounty on Global Masters

Hey, Developer Community!

We’ve launched a brand-new activity on Global Masters — the Article Bounty!
It’s your chance to share your expertise, help fellow developers, and, of course, earn points while doing it.

👉 Join the August Article Bounty on Global Masters here

 

Earlier, we launched the Submit an Article Idea challenge — where Global Masters members could suggest new articles, tutorials, how-tos, and more. We received an overwhelming number of fantastic ideas! 

👉  Now, once a month, we’ll publish a list of 10 in-demand topics requested by the community.
You can choose a topic from the list, write an article about it, and earn bounty of 🏆 5,000 
points when the article is approved.

🏆August Article Bounty

Time: 7 — 31 August
Deadline to publish an article and send a link via Global Masters: August 31

August topics:

  1. Best coding practices for first‑time ObjectScript developers. Practical code examples: how to use Dynamic Objects – best practices, how to use globals, etc.
  2. SQL table creation for Relational tables
  3. Experiences with using copilot tools with ObjectScript (especially if you are seeing good results!)
  4. InterSystems API Manager – Configuration and Utilization Steps
  5. Best Practices for Designing %Persistent Classes in InterSystems IRIS. A guide to structuring persistent classes efficiently, including tips on indexing, relationships, and validation to ensure performance and maintainability.
  6. Using Docker to Modernize Legacy InterSystems Environments — Show how to containerize InterSystems IRIS applications for local development, testing, and deployment, including configuration and orchestration basics.
  7. “How to Use Studio and VS Code Efficiently for InterSystems Development” — Tips and setup guide for developers transitioning to VS Code with the InterSystems ObjectScript extension.
  8. Advanced FHIR Implementation Patterns with InterSystems IRIS
  9. Explanation of the operation properties like Stay connected, Connect timeout, Reconnect retry, Response timeout, Read timeout. Explain what these mean in detail and how each of these settings impact each other.
  10. Diagnosing and Resolving Common InterSystems ObjectScript Errors

P.S. If you find that an up-to-date article already exists for a suggested topic, just send us the link, mark it as "Existing," and earn 30 points for helping us identify it.

Rules to follow:

  • The article should follow the general >>Developer Community Guidelines<<  and should not be written by AI.
  • Article size: 400 words minimum (links and code are not counted towards the word limit).
  • The article must be about InterSystems products and services.
  • The article must be in English (including inserting code, screenshots, etc.).
  • The article must be 100% new.
  • The article cannot be a translation of an article already published in other communities.
  • The article should contain only correct and reliable information about InterSystems technology.

Articles on the same topic but with dissimilar examples from different authors are allowed.

1 nouveau commentaire
Discussion (1)1
Connectez-vous ou inscrivez-vous pour continuer