How is your experience with the OutSystems Community?
53
Views
4
Comments
Error executing query. Error in advanced query SQL
Application Type
Reactive
Service Studio Version
11.55.83 (Build 65121)

Hi All,

I'm a new OutSystems developer and would appreciate your advice.

I encountered the following error in an OutSystems Timer:

Error:
Error executing query.
Error in advanced query SQL_...
ORA-01013: user requested cancel of current operation

Environment:
- OutSystems + Oracle Database (19c)
- The main source table had 0 records (this is a rare situation)
- Other source tables contained records, but the volume was small
- The execution time was shorter than usual
- No manual Timer abort was performed
- The Timer started at the scheduled time

This Timer normally runs without issues. Since the main source table contained no records, I expected the query to return 0 rows and complete successfully.

Although I understand that an empty result set itself should not cause ORA-01013, the fact that the main source table had 0 records is the only unusual condition compared to normal executions. Could this scenario be related in any way to the error?

Has anyone experienced ORA-01013 under similar conditions?

Are there any known causes in OutSystems or Oracle that could automatically cancel a query, such as:
- Session termination
- Query timeout
- Network issues
- Database maintenance
- Resource Manager restrictions
- Other Oracle-side settings

Any advice or troubleshooting suggestions would be greatly appreciated.

Thanks in advance.
Hu

2023-12-26 10-35-28
OutSystems Neo
Staff
AI Generated

You’re right that “0 rows” by itself shouldn’t cause ORA‑01013. That error almost always means “the server aborted the work” (usually due to timeout, connection drop, or session kill), not a logical problem with the query result.

Given your description and the forum cases you shared, here’s how I’d look at it from an OutSystems + Oracle 19c perspective.


Almost certainly only indirectly, if at all.

Oracle does not cancel a query because a table is empty. The query optimizer might even execute faster with an empty table. So:

  • If this timer normally runs fine;
  • This run had a shorter duration than usual;
  • The only difference is that the main table had 0 records;

Then the “0 rows” condition is likely a red herring. ORA‑01013 was more probably triggered by:

  • a timeout in OutSystems or Oracle, or
  • a network / session problem at the exact moment the query was running.

The examples you provided support this: ORA‑01013 is consistently reported as a timeout or blocking/locking symptom, not as a data-content symptom. ORA-01013: user requested cancel of current operation


2. Common real‑world causes in OutSystems + Oracle

Here are the most typical causes I’ve seen (and that appear in your referenced topics):

  1. Execution timeout (application or infrastructure)

    • OutSystems timers have a configured timeout (platform setting). If the timer execution, or a specific query inside it, takes longer than that, the scheduler can abort it.
    • For web / reactive flows there are also default timeouts (e.g. 10s) that can manifest as ORA‑01013 on Oracle. CreateOrUpdate entity action times out
  2. Database locking / transaction issues

    • Some other process (timer, BPT, or long-running transaction) might hold locks on the same Oracle objects your Advanced Query is touching.
    • If your timer is:
      • Updating/inserting into a table while another process holds a lock, or
      • Reading with locking hints, or
      • Running in a separate transaction while another service action hasn’t committed yet,
        Oracle may block your query until it hits some global or connection timeout, resulting in ORA‑01013.
    • In one of your examples the fix was to commit before calling a service action, so the second transaction didn’t get blocked by uncommitted changes. CreateOrUpdate entity action times out
  3. Network / connection drops

    • If the app server loses connectivity to Oracle mid-execution (firewall reset, load balancer, TCP idle timeout, etc.), .NET / OutSystems can translate that into ORA‑01013 because Oracle sees the session as abruptly terminated.
  4. Scheduler / timer infrastructure errors

    • In the timer case you pasted (underlying connection was closed), the root cause was processing too much data per run; the solution was to chunk the work and re-schedule the timer for the remaining data. Timer being aborted - The underlying connection was closed: An unexpected error occur
    • Even though your current run had less data, something similar (connection closed by host) might have happened on the infrastructure side.
  5. Oracle Resource Manager / maintenance operations

    • DBAs might configure Resource Manager to automatically abort or downgrade sessions that exceed certain limits (CPU, I/O, elapsed time).
    • Maintenance jobs (like statistics gathering, index rebuilds, or backup/restore operations) could also kill sessions, although that is less common.

3. Targeted checks you can do

Because you’re using an Advanced Query inside a Timer, I’d follow this checklist:

3.1. Collect exact context from Service Center

  • Go to Service Center → Monitoring → Timers and:

    • Confirm Execution Start / End time.
    • Check if the log mentions “request duration = X secs” or similar (like the example you included), which may indicate a timer timeout.
    • See if there were automatic retries (OutSystems will retry failed timers).
  • Check General Logs / Error Logs around that time:

    • Look for “connection was closed”, “request timeout”, “thread aborted”, or similar messages.

3.2. Ask DBA for Oracle-side info

Ask your DBA to check around the timestamp of the error:

  • alert.log and listener logs for:
    • session killed, resource manager actions, network disconnects.
  • Any Resource Manager rules active (e.g. maximum elapsed time per query).
  • Any scheduled maintenance job or backup/restore around that time.

Also: see if Oracle’s v$session / v$session_event / dba_audit_trail captured your session being terminated.

3.3. Review the Advanced Query itself

Even if the main table is empty, check for:

  • Joins to other tables that might be large or have missing indexes.
  • Functions or expressions in WHERE clauses that could disable index usage.
  • Hints or locking clauses (e.g. FOR UPDATE) that could cause blocking.
  • WITH (NOLOCK) is not valid in Oracle, but ensure no custom hints break things.

You can get the SQL from the Advanced Query and ask the DBA to:

  • Run it manually in SQL*Plus/SQL Developer at the same time of day,
  • Capture its execution plan and runtime,
  • Check if there’s any wait event (locks, I/O, etc.) associated with it.

3.4. Check for parallel timers / processes

Verify if:

  • This timer might run overlapping instances (e.g., previous run still working when the next one starts).
  • Any BPT processes, other timers, or integrations are touching the same tables (either source or target).
  • Any Service Actions called from the timer are uncommitted or long-running, causing cross-transaction locking (as in the CreateOrUpdate example). CreateOrUpdate entity action times out

3.5. Timer and Platform configuration

With your platform admin:

  • Confirm Timer execution timeout in Configuration Tool / factory settings:
    • If the timer is close to that time, an occasional spike (network, DB load) can push it over the limit.
  • Confirm DB connection timeout and pool settings.

4. Practical mitigations / tests

To narrow it down and avoid surprises:

  1. Log more context in the Timer

    • Log:
      • Input parameters.
      • Actual SQL parameter values.
      • Elapsed time before/after critical queries.
    • This helps confirm if the failure is consistently after a specific Advanced Query.
  2. Run a “no-op” version of the Timer

    • Temporarily replace the Advanced Query with a simple “SELECT 1 FROM DUAL” or a minimal query.
    • If ORA‑01013 still occurs, you’re very likely dealing with connection/timer timeout or infrastructure issues rather than the query logic.
  3. Chunk the work (if not already)
    Even if this specific run had fewer records:

  4. Ensure proper commits

    • If the timer calls Service Actions or other actions that may encapsulate their own transactions, consider:
      • Adding explicit CommitTransaction when appropriate (careful with consistency).
      • Avoiding long-running uncommitted updates before calling external logic.

5. Direct answers to your specific questions

Could the empty main source table be related?

Not directly. Oracle will not cancel a query because the main table has 0 rows. The empty table likely just coincided with another issue (timeout, session kill, or network problem) that caused ORA‑01013.

Have others seen ORA‑01013 in similar conditions?

Yes. In OutSystems environments, ORA‑01013 is commonly reported when:

Are there known automatic causes (session termination, query timeout, etc.)?

Yes, all of these are plausible:

  • OutSystems timer timeout.
  • DB connection timeout (application server side).
  • Oracle Resource Manager limits.
  • Network / firewall / LB closing idle or long-lived connections.
  • DBA killing sessions (manual or via jobs).
  • Locked resources causing the engine to abort the call after some time.

If you can share (internally) the approximate duration when it fails, timer timeout configuration, and confirmation from the DBA whether your session was killed, you’ll probably pinpoint whether this is a simple timeout, a locking issue, or a network/session closure.

This answer was AI-generated. Please read it carefully and use the forums for clarifications
2023-09-21 12-55-43
SIRAJKHILJI

What I would investigate first

1. Check whether OutSystems cancelled the database request

Look at the Timer execution details around the exact timestamp.

You want to establish:

Timer started↓Advanced SQL started↓ORA-01013↓Timer failed

Compare the timestamps with a successful execution.

If the SQL normally takes, for example:

Normal: 10 minutes Failure: 30 seconds

then a database query timeout becomes less likely.

If instead:

Normal: 10 minutes Failure: exactly 60 seconds

or:

exactly 5 minutes

then I would strongly investigate an application/infrastructure timeout.

2026-03-03 06-24-34
Grijesh Suman

Hello @Chen Hu

According to Oracle, ORA-01013 ("user requested cancel of current operation") indicates that Oracle received a request to cancel a SQL operation while it was executing. Oracle treats this as an interruption rather than a SQL processing error.

For an OutSystems Timer, some common causes include:

Application-side query timeouts

The OutSystems platform, Oracle client, or middleware may cancel a query if it exceeds a configured timeout threshold.

Oracle drivers can return ORA-01013 when a command timeout occurs.

Session cancellation or termination

A DBA or an automated process may have cancelled or terminated the database session.

Regarding the scenario where the main source table contained 0 records, this condition alone would not normally cause ORA-01013. When the driving table is empty, Oracle typically returns an empty result set and completes the query successfully, often faster than usual.

My suggestion review OutSystems logs for:

Query timeout messages

Timer abort events

Connection-related errors

Database alert logs

Oracle Resource Manager configurations

Any session cancel or kill operations that occurred during the Timer execution window

On top of that Verify timeout configurations in:

OutSystems

Oracle client/provider settings

Application server settings

Conclusion

Based on the information provided, an empty source table by itself should not generate ORA-01013. The error typically indicates that the SQL execution was interrupted by a timeout, session cancellation, administrative action, network-related issue, or an Oracle resource-management policy rather than by the query returning no rows.

2025-08-07 06-30-56
Amit J
Champion

Hi @Chen Hu

ORA-01013 means "user requested cancel" — but in practice it's almost never an actual user clicking cancel. It's Oracle's generic message for "something external killed this query before it finished." The empty main table isn't the cause — it's just a coincidence that happened on the same run.

Most likely causes, in order of probability:

  1. Timer timeout (most common) — OutSystems Timers have a max execution time set in Service Center (Administration → Timers). If this run finished faster than usual but still got cancelled, check if the timeout is set too low and something (locking, connection pool) delayed the start internally.

  2. Query/statement timeout at the DB or connection pool level — Check the CommandTimeout on the Oracle connection in Service Center, or any DB-side resource limits (Resource Manager, profile limits) that could kill long/idle queries.

  3. Session killed externally — DBA scripts, Oracle jobs, or Resource Manager policies that kill sessions matching certain criteria (idle time, resource usage) can throw exactly this error even for short-running queries.

  4. Connection pool recycling — if the app pool or DB connection got recycled/reset mid-query (deploy, restart, pool timeout), Oracle reports it the same way.

  5. Network blip — a dropped connection between OutSystems and Oracle can also surface as ORA-01013.

What I'd check first:

  • Timer timeout setting in Service Center for that specific Timer.
  • Oracle alert log / AWR around that exact timestamp — look for session kills, Resource Manager actions, or instance events.
  • Whether any deploy, restart, or pool recycle happened around that time.

Since it's intermittent and not tied to data volume, it's very unlikely to be a code issue — this is almost always infrastructure/environment level. If you can pull the exact timestamp and check the Oracle alert log for that minute, that'll usually tell you who killed the session.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.