<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by syan zen on Medium]]></title>
        <description><![CDATA[Stories by syan zen on Medium]]></description>
        <link>https://medium.com/@syanzen?source=rss-f82d26333b2c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6z-IzL3zNuc_ElP7CqPGjg.png</url>
            <title>Stories by syan zen on Medium</title>
            <link>https://medium.com/@syanzen?source=rss-f82d26333b2c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:42:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@syanzen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Claude Code Headless Mode (claude -p): 11 Gotchas, Measured]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@syanzen/claude-code-headless-mode-453db2622cec?source=rss-f82d26333b2c------2"><img src="https://cdn-images-1.medium.com/max/1500/1*ixcFKVRrqtY1WyQsoV1ldg.jpeg" width="1500"></a></p><p class="medium-feed-snippet">The same three-step task in claude -p cost me $0.10 or $0.23 when my claude.ai connectors loaded partway through it, and under half a cent&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@syanzen/claude-code-headless-mode-453db2622cec?source=rss-f82d26333b2c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@syanzen/claude-code-headless-mode-453db2622cec?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/453db2622cec</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-19T00:01:02.377Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Oracle APEX — Import Excel File to Table]]></title>
            <link>https://medium.com/@syanzen/oracle-apex-import-excel-file-to-table-3b4c4c935199?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b4c4c935199</guid>
            <category><![CDATA[plsql]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[oracle-apex]]></category>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-17T00:01:02.194Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Three ways to get an .xlsx into a table on APEX 26.2: the Data Workshop in a few clicks, a generated Data Loading page with a lookup and a merge, and APEX_DATA_PARSER with a staging table. Every result here came from a 5,000-row workbook, a 50-row update file and a few small CSV files, all built to misbehave, loaded on a throwaway database and read back.</em></h4><p><em>How this was made: I wrote this with Claude Code. A Claude Code session on my Mac built the workbook with a script, ran every load in this post against a throwaway APEX 26.2 database, drove the Builder and the sample app through a scripted browser, ran the parser examples against workbooks stored as BLOBs in a table, and read each result back from the tables and the APEX views. I made the calls; the test passwords were generated into a locked folder and never typed into the chat.</em></p><figure><img alt="A small coral-orange robot feeds a green spreadsheet sheet into a slate-gray funnel that pours tidy rows into a deep red database cylinder; a few crumpled sheets lie on the floor beside the funnel." src="https://cdn-images-1.medium.com/max/1024/1*D7RWGraoJmWI0Tz5nsGmLQ.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><p>Type “oracle apex import excel file to table” into a search engine and the results are Oracle’s documentation for the Data Workshop, an older post on the Data Load utility it replaced, a tutorial that parses the file into a collection, and forum threads about delimiters, character sets and a header that is not on row 1, the ones I found without an accepted answer. I found no walk-through on a current version that loads a real workbook, with the mess real workbooks have, and says what happened to every bad cell.</p><p>So I built one. A 5,000-row orders workbook with three sheets and a set of planted problems: three country names that are not in the lookup table, four empty amounts, one empty quantity, six statuses typed in lower case, a quantity typed as text, an amount typed as the text “1,234.50”, a date typed as the text “15/03/2026”, and a third sheet whose header sits on row 3 under two title rows. Then I loaded it on APEX 26.2 three ways, and read the tables back after each one.</p><h3>The short version</h3><ul><li><strong>The Data Workshop</strong> (SQL Workshop → Utilities → Data Workshop) loads an .xlsx into a new table or an existing one in a few clicks. It typed the columns correctly, rejected the two rows it could not convert into an error table and told me which two, and it also detected a semicolon delimiter, a decimal comma and a Western European encoding on its own. It has no lookups, no value rules beyond a trim and a null marker, no skip-rows setting and no merge: an existing table gets Append or Replace.</li><li><strong>A Data Loading page</strong> in your own app needs a Data Load Definition first (Shared Components), and the wizard that creates it offers to add the page. The definition’s data profile is where lookups (a country name becomes a country ID), transformations (upper case) and the primary key live. The wizard picks the loading method from the primary key, Merge if you ticked one in Map Columns and Append if not, and either way the default When on Error is Stop, which in my run under Append aborted the load at the first bad row with the raw ORA message and left the table empty.</li><li><strong>Append is not insert.</strong> With a primary key in the profile, Append skipped the 30 rows that already existed, inserted the 20 new ones and reported “0 errors”. On a rerun without the primary key it reported 50 errors out of 50. Of Append and Merge, only Merge changed the 30 existing rows.</li><li><strong>APEX_DATA_PARSER.PARSE</strong> reads a 5,000-row sheet in about two and a half seconds and gives you every cell as text. Dates come back as 2026-08-04, not as Excel serial numbers. The sheet parameter wants the sheet&#39;s file name (sheet2.xml), not the tab name; the tab name raises ORA-20987.</li><li><strong>Stage, validate, merge.</strong> An insert straight from the parser into the real table failed on the first bad row and loaded nothing. Parsing into a staging table, marking the nine bad rows in plain language, and merging the 4,991 good ones took three steps and left the user a list of what to fix.</li><li><strong>Of the usual forum traps,</strong> the Windows-1252 file needs one parameter in the parser and the semicolon file none, a decimal comma needs a conversion in SQL, and the Data Workshop handled all three on its own. The UTF-8 byte order mark did not reproduce in the parser. The header on row 3 takes one setting in the parser. In a data profile, Skip Rows was not enough on its own (the dates then failed on the mask), and the Data Workshop has no setting for it.</li></ul><h3>What you need</h3><p>APEX 26.2 (I tested 26.2.0 in a container behind ORDS 26.3 and did not run 26.1), a workspace developer login, and a table to load into. The tables here are small:</p><pre>create table xl_countries (<br>  country_id   number generated by default on null as identity primary key,<br>  country_name varchar2(60) not null unique,<br>  iso_code     varchar2(2)  not null unique<br>);<br> <br>create table xl_orders (<br>  order_no    number        primary key,<br>  order_date  date          not null,<br>  customer    varchar2(100) not null,<br>  country_id  number        not null references xl_countries,<br>  amount      number(12,2)  not null,<br>  qty         number(6),<br>  status      varchar2(10)  not null check (status in (&#39;NEW&#39;,&#39;PAID&#39;,&#39;SHIPPED&#39;,&#39;CANCELLED&#39;)),<br>  notes       varchar2(400)<br>);<br> <br>create table xl_returns (<br>  return_no   number primary key,<br>  order_no    number not null,<br>  return_date date   not null,<br>  reason      varchar2(100)<br>);<br> <br>create table xl_files (<br>  file_id    number generated by default on null as identity primary key,<br>  file_name  varchar2(255) not null,<br>  mime_type  varchar2(255),<br>  content    blob<br>);</pre><p>XL_COUNTRIES holds twelve rows, from Malaysia to India, with United Kingdom, Vietnam and United States spelled that way, so the sheet&#39;s UK, Viet Nam and USA find no match. XL_RETURNS takes the second sheet in Step 1. XL_FILES holds the uploaded workbooks for Steps 2 to 5; in my test the files got there from a directory object through DBMS_LOB.LOADBLOBFROMFILE, in an app they arrive from a File Browse item.</p><p>The workbook, orders.xlsx, is about 220 KB. Sheet 1, <em>Orders</em>, has a header row and 5,000 rows with the columns Order No, Order Date, Customer, Country, Amount, Qty, Status and Notes; the dates are real Excel dates and the amounts are real numbers formatted with thousands separators. Sheet 2, <em>Returns</em>, has 200 rows. Sheet 3, <em>Report</em>, has two title rows, the header on row 3, and 50 rows whose dates and amounts are text, the way a report pasted into Excel looks. A second workbook, orders-update.xlsx, repeats 30 existing order numbers with a new status and amount and adds 20 new ones.</p><h3>Step 1: The quick path, the Data Workshop</h3><p>SQL Workshop → Utilities → Data Workshop → Load Data. Drop the file on the dialog. The dialog says which formats it takes (csv, xlsx, txt, xml, json), reads the first 200 rows to guess the column types, and shows a preview with the sheet picker, the encoding and the header checkbox.</p><figure><img alt="The Oracle APEX Data Workshop Load Data dialog for orders.xlsx with Load To set to New Table, Table Name XL_ORDERS_WS, Primary Keys set to Identity Column, Use Column Data Types ticked, Select Sheet showing Orders, File Encoding Unicode UTF-8, and a preview showing the header line and four data rows of the order columns." src="https://cdn-images-1.medium.com/max/1024/1*1XMi23gxWwkXcOc6p06ieA.png" /><figcaption>Load Data in the Data Workshop: new table, sheet picker, encoding, and a five-row preview, with the types sampled from the first 200 rows.</figcaption></figure><p><strong>New table.</strong> I named it XL_ORDERS_WS, left <em>Use Column Data Types</em> ticked, and clicked Load Data. A few seconds later:</p><blockquote><em>Table XL_ORDERS_WS created! 4,998 rows loaded successfully. 2 rows rejected.</em></blockquote><p>The two rejected rows were the two I planted as text: the amount “1,234.50” failed with ORA-01722 (“unable to convert string value containing ‘,’ to a number”) and the date “15/03/2026” with ORA-01861 (“literal does not match format string”). Both sit in an error table named after yours with an ERR$ suffix (mine was XL_ORDERS_WS_ERR$1, the second load of that name), with the error message and every column of the row as text, and the dialog shows them.</p><figure><img alt="The Load Data result showing Table XL_ORDERS_WS created, 4,998 rows loaded successfully, 2 rows rejected, and a Rejected Rows table listing ORA-01722 for order 13902 with the amount 1,234.50 and ORA-01861 for order 14202 with the date 15/03/2026." src="https://cdn-images-1.medium.com/max/1024/1*4Ilzt6hw6qZoaMTOSvikLg.png" /><figcaption>What the Data Workshop does with a cell it cannot convert: the row goes to an error table and the dialog names it.</figcaption></figure><p>The table it made has an ID identity column as the primary key (you can choose SYS_GUID instead), ORDER_NO, AMOUNT and QTY as NUMBER, ORDER_DATE as DATE, and the text columns as VARCHAR2(50), which looks like a default rather than a measured width (my longest value was 20 characters; I did not test a longer value past the 200 sampled rows). The 4,998 rows it kept tell you what it does with the rest of the mess: the four empty amounts became NULL, the blank quantity became NULL, the quantity typed as text &quot;12&quot; became 12, the six lower-case statuses stayed lower case, and the three country names that are not in the lookup table (&quot;UK&quot;, &quot;Viet Nam&quot;, &quot;USA&quot;) loaded as the text they were, because there is no lookup here.</p><p>Click <em>Preview</em> on the dialog and a <em>Columns to Load</em> tab lets you change each column’s type, length, format mask, group separator and decimal character before loading, and sample 1,000, 5,000 or all rows instead of 200. There is no field for skipping rows. The <em>Report</em> sheet, with its header on row 3, previews with the two title rows as rows 1 and 2 and the real header as row 3. I did not load it. For that sheet, fix the file, use the parser in Step 3, or give it its own definition with Skip Rows in Step 2 (in my test that got past the column check and then needed a different date mask, which I did not finish).</p><p><strong>Existing table.</strong> Switch <em>Load To</em> to Existing Table and pick the table from a popup. First, the only methods are <em>Append</em> and <em>Replace</em>, so there is no merge on this path. Second, the automatic column mapping runs when you pick the table, using whatever sheet is selected at that moment. I picked XL_RETURNS first and switched to the <em>Returns</em> sheet second, and the dialog said &quot;1 out of 4 columns have been automatically mapped&quot; (only Order No, which both sheets have); the load then failed every row with ORA-01400 on RETURN_NO, 200 rows into XL_RETURNS_ERR$. Sheet first, then table, and it said &quot;All 4 columns have been automatically mapped to the XL_RETURNS table&quot; and loaded 200 rows. The <em>Configure</em> button opens the mapping if the names do not match.</p><p><strong>What it says when the file is wrong.</strong> Upload a .docx and the dialog says: “Unsupported File. Oracle APEX could not find columns in the uploaded file, as the file format or structure is unsupported. Please upload another file.” A .txt is treated as CSV, with delimiter and enclosure pickers. A CSV with one row of nine fields and one of six, against an eight-column header, loaded without complaint: the extra field went to a new column COL009 and the short row got NULLs in its last two. Nothing stops you; check the column count in the preview.</p><h3>Step 2: A Data Loading page in your app</h3><p>On 26.2, App Builder → Create Page → Data Loading opens a page dialog whose <em>Data Load</em> select list is empty until the application has a Data Load Definition. So the page starts in Shared Components → Data Load Definitions → Create. The wizard has four steps: Target (a name, and the table, picked from a popup), Sample Data (upload the workbook), Map Columns, and Navigation Menu; the Create and Add Page button on Map Columns hands over to the Create Page dialog instead. If the <em>Table Owner</em> list is empty on the first step and Next answers “#LABLE# must be specified” and “Table XL_ORDERS does not exist. Note that the table name is case-sensitive.”, you reached the definitions page from a bookmarked URL without opening the application first; open the app, then Shared Components.</p><figure><img alt="The Create Data Load wizard’s Map Columns step showing Skip Rows, Select Sheet set to Orders, File Encoding, and a Column Mapping grid where COUNTRY is unmapped, ORDER_DATE maps to ORDER_DATE with the format mask YYYY”-”MM”-”DD, AMOUNT has a decimal character, and the Primary Key checkbox is clear on every row." src="https://cdn-images-1.medium.com/max/1024/1*IQzeJwwDccEX_Ko2D2cnYA.png" /><figcaption>Map Columns: the sample file’s columns against the table’s, with a format mask for the date and a decimal character for the amount. Country has nothing to map to, and every Primary Key box starts clear.</figcaption></figure><p>Map Columns has <em>Skip Rows</em> (the setting the Data Workshop lacks) and <em>Select Sheet</em>, and a grid with one row per column in the sample: what it maps to, the format mask it detected for the date, the decimal character for the number, and a Primary Key checkbox, clear on every row until you tick one. I ticked it for Order No. My <em>Country</em> column mapped to nothing, because the table has COUNTRY_ID and the sheet has names. I left it unmapped and clicked <em>Create and Add Page</em>, which went straight into the Create Page dialog with the definition preselected; I gave the page the number 900 and the name Load Orders. The page it made has a file item, a worksheet select list, a preview region, and a Load Data process of the type Data Loading.</p><p>Then the definition. Open it from the list and you get the settings that decide how a load behaves:</p><ul><li><strong>Loading Method</strong>: Append, Merge or Replace. The wizard set Merge because I had ticked a primary key; a second definition made without ticking one came out as Append.</li><li><strong>Commit Interval</strong>: 200.</li><li><strong>When on Error</strong>: Ignore, Stop, Log Error into Collection, or Log into Error Log. The wizard set Stop.</li><li><strong>Data Profile</strong>: the columns, with an <em>Edit Data Profile</em> button.</li></ul><p><strong>The lookup.</strong> The wizard dropped my unmapped Country column from the profile, so the first job was to add it back and give it something to feed. <em>Add Column</em> twice. The first is a Data column named COUNTRY, type Varchar2, selector type Name, selector Country (the header text in the sheet). The second is the column type Lookup, named COUNTRY_ID, type Number, with the lookup table XL_COUNTRIES, return column COUNTRY_ID, and table column 1 COUNTRY_NAME matched to data column 1 COUNTRY. There is room for three match columns and a where clause.</p><figure><img alt="The Data Profile Column editor in the APEX Builder with Column Type Lookup, Name COUNTRY_ID, Data Type Number, Owner DEMO2, Table Name XL_COUNTRIES, Return Column COUNTRY_ID, Table Column 1 COUNTRY_NAME and Data Column 1 COUNTRY." src="https://cdn-images-1.medium.com/max/1024/1*3Zxdw6clx7C8GkE6bqJsJA.png" /><figcaption>A Lookup column: the sheet’s country name goes in, the table’s COUNTRY_ID comes out.</figcaption></figure><p>A profile column whose name matches no table column is not loaded, so the text COUNTRY column is harmless; it exists for the lookup to read. The other column types are SQL Expression and SQL Query, for anything a lookup cannot express.</p><p><strong>The transformation.</strong> Open the STATUS column and set <em>Value Transformation</em> to To Upper Case. The list is Left Trim, Right Trim, Trim, Replace, To Lower Case, To Upper Case, Null If, Regular Expression Replace and Regular Expression Null If. The same editor has the Primary Key switch, and the profile&#39;s column list shows Yes or No for each column; mine showed Yes for ORDER_NO from the box I ticked in Map Columns. Tick it, because the Append and Merge results below depend on it.</p><p><strong>Running it.</strong> Log in to the app, open the page, drop the workbook. The page lists the three sheets, previews the chosen one, and has a Load Data button. I set the method to Append for the first run and left <em>When on Error</em> at Stop. The whole load ended with one line, “ORA-01400: cannot insert NULL into (“DEMO2”.”XL_ORDERS”.”COUNTRY_ID”)”, and the table was empty: the first unknown country, on row 102, stopped everything. My guess is that the 100 rows before it sat inside the first commit batch of 200; whether a batch committed before a later bad row survives, I did not test.</p><p>The other error modes come with conditions. <em>Log into Error Log</em> was refused by the Builder as soon as I applied it, with two errors: “Log into Error Log not supported for Merge loading method nor Append loading method if a primary key column defined.” and “Error Logging Table must be specified”. <em>Log Error into Collection</em> asks for a collection name; I called it ORDERS_ERRORS. With that, the same workbook gave:</p><blockquote><em>Data loading finished: 5000 rows processed with 9 errors.</em></blockquote><figure><img alt="The Load Orders page in the Brookstrut sample app with a green success message reading Data loading finished: 5000 rows processed with 9 errors, the loaded file orders.xlsx, the XLSX Worksheet select list showing Orders, and a preview of the first order rows." src="https://cdn-images-1.medium.com/max/1024/1*4_hAtQsgwUo36M5dE8sCVw.png" /><figcaption>The generated page after a load.</figcaption></figure><p>The table had 4,991 rows, every status in upper case, and every country ID filled from the lookup. The nine errors are the nine rows my staging route rejects in Step 4: the three unknown countries (the lookup returned NULL and the NOT NULL constraint rejected the row), the four empty amounts, the text amount and the text date. The page shows the count and nothing else. The collection lives in the APEX session, so I read it from the PL/SQL run further down; it held, per error, the ORA message in C001 and the data row number in N001 (101 for sheet row 102), and no column values, so a report on APEX_COLLECTIONS can tell the user which rows to fix but not what was in them.</p><p><strong>Append and Merge.</strong> With the method still Append, I loaded the update workbook, 30 existing orders and 20 new ones. The message was “50 rows processed with 0 errors”, and the table had 5,011 rows: the 20 new ones were in, and the 30 existing ones were untouched, with their old statuses and amounts. Append with a primary key in the profile skips the rows that already exist and does not count them as errors. I turned the primary key off and ran the same file again: “50 rows processed with 50 errors”, presumably unique-key violations, since all 50 keys were present by then; I did not read the collection for that run. With the primary key back on and the method set to Merge, the same file gave “50 rows processed with 0 errors”, order 10001 was SHIPPED at 3,518.06, and the table still had 5,011 rows: all 50 rows updated, since the Append run had already inserted the 20.</p><p><strong>What the page refuses.</strong> A CSV or a .docx: “Invalid file type. Supported file types XLSX.”, because the profile’s format is XLSX. The <em>Report</em> sheet, chosen from the page’s select list: “ORA-20999: Data profile and uploaded file do not contain any target table column.”, because the page has no skip-rows control and the profile’s Skip Rows was blank. Run through APEX_DATA_LOADING.LOAD_DATA rather than the page, a second definition with Skip Rows set to 2 got past the column check and failed with &quot;ORA-01861: literal does not match format string&quot;, since that sheet writes dates as 04/08/2026 and the profile&#39;s mask says YYYY-MM-DD. Skip Rows and the format masks are one value per definition, so a sheet with a different layout needs a definition of its own.</p><p><strong>From PL/SQL.</strong> The same definition runs without the page. I ran it inside an APEX session, which a page process already has and which APEX_SESSION.CREATE_SESSION provides from SQLcl; the static ID orders is on the definition&#39;s Advanced tab:</p><pre>set serveroutput on<br>declare<br>  l_blob   blob;<br>  l_result apex_data_loading.t_data_load_result;<br>begin<br>  apex_session.create_session(p_app_id =&gt; 200, p_page_id =&gt; 900, p_username =&gt; &#39;TUTOR2&#39;);<br>  select content into l_blob from xl_files where file_name = &#39;orders.xlsx&#39;;<br>  l_result := apex_data_loading.load_data(<br>                p_static_id       =&gt; &#39;orders&#39;,<br>                p_data_to_load    =&gt; l_blob,<br>                p_xlsx_sheet_name =&gt; &#39;sheet1.xml&#39;);<br>  dbms_output.put_line(&#39;processed_rows=&#39; || l_result.processed_rows || &#39; error_rows=&#39; || l_result.error_rows);<br>  apex_session.delete_session;<br>end;<br>/</pre><p>On an emptied XL_ORDERS that printed processed_rows=5000 error_rows=9, and filled the collection described above. Note the sheet name: sheet1.xml, the file inside the workbook, not the tab name. Passing Orders raised &quot;ORA-20987: APEX - Specified worksheet does not exist in XLSX file.&quot;</p><h3>Step 3: The parser, APEX_DATA_PARSER</h3><p>When the page needs to do something the data profile cannot, the parser is a table function you can query directly. I stored the workbook as a BLOB in XL_FILES. A File Browse item puts the upload in APEX_APPLICATION_TEMP_FILES (columns BLOB_CONTENT and FILENAME); I did not build that page, so the code below is tested against my own table.</p><p>First, what sheets the workbook has:</p><pre>select sheet_sequence, sheet_display_name, sheet_file_name<br>  from xl_files f,<br>       table(apex_data_parser.get_xlsx_worksheets(p_content =&gt; f.content))<br> where f.file_name = &#39;orders.xlsx&#39;;</pre><p>That gave Orders as sheet1.xml, Returns as sheet2.xml and Report as sheet3.xml, and sheet_file_name is what the p_xlsx_sheet_name parameters want. The tab name raises the same ORA-20987 as in Step 2. Then what the parser makes of the columns:</p><pre>select c.column_position, c.column_name, c.data_type, c.format_mask<br>  from xl_files f,<br>       table(apex_data_parser.get_columns(<br>               apex_data_parser.discover(p_content =&gt; f.content, p_file_name =&gt; f.file_name))) c<br> where f.file_name = &#39;orders.xlsx&#39;;</pre><p>DISCOVER reads the first 200 rows and returns a JSON profile; GET_COLUMNS turns it into rows. For the <em>Orders</em> sheet it said NUMBER for the order number, amount and quantity, DATE with the format mask YYYY&quot;-&quot;MM&quot;-&quot;DD for the date, and VARCHAR2(50) for the rest. Then the rows:</p><pre>select p.line_number, p.col001, p.col002, p.col003, p.col004, p.col005<br>  from xl_files f,<br>       table(apex_data_parser.parse(p_content =&gt; f.content, p_file_name =&gt; f.file_name,<br>                                    p_xlsx_sheet_name =&gt; &#39;sheet1.xml&#39;, p_max_rows =&gt; 6)) p<br> where f.file_name = &#39;orders.xlsx&#39;;</pre><p>What comes back:</p><ul><li>Line 1 is the header row, as data, so filter line_number &gt; 1 when you load. With p_skip_rows =&gt; 2 the header is line 3 and the data starts at line 4.</li><li>Every column is text, COL001 to COL300, each up to 32,767 bytes.</li><li>A real Excel date arrives as 2026-08-04, already converted from the serial number, which is why the mask above is what it is. A date typed as text arrives as typed: 15/03/2026.</li><li>A real number arrives as 3198.24, without the #,##0.00 display format I gave the cells. A number typed as text with a thousands separator arrives as 1,234.50.</li><li>An empty cell is NULL. A quantity typed as the text “12” is 12.</li><li>All 5,001 lines of the big sheet took 2.54 seconds.</li></ul><p>For the <em>Report</em> sheet, p_skip_rows =&gt; 2 skips the two title rows, and the header on row 3 becomes line 3 of the output with the column names DISCOVER can use. Without it, DISCOVER named the first column ORDERS_REPORT__Q1_2026 and the others COL002 to COL004.</p><p>The parser decides the format from the file name. A .txt with CSV content parsed as CSV; the .docx raised “ORA-20987: Uploaded file is invalid or has wrong extension.” With no file name at all, p_file_type =&gt; 2 told it to treat the content as CSV (2 is the package constant c_file_type_csv; in a SQL statement use the literal, since the constant only resolves in PL/SQL).</p><h3>Step 4: Stage, validate, merge</h3><p>The tempting shortcut is to insert from the parser straight into the real table:</p><pre>insert into xl_orders (order_no, order_date, customer, country_id, amount, qty, status, notes)<br>select p.col001, to_date(p.col002, &#39;YYYY-MM-DD&#39;), p.col003,<br>       (select country_id from xl_countries c where c.country_name = p.col004),<br>       p.col005, p.col006, p.col007, p.col008<br>  from xl_files f, table(apex_data_parser.parse(p_content =&gt; f.content, p_file_name =&gt; f.file_name)) p<br> where f.file_name = &#39;orders.xlsx&#39; and p.line_number &gt; 1;</pre><p>It failed with “ORA-01400: cannot insert NULL into (“DEMO2”.”XL_ORDERS”.”COUNTRY_ID”)” and the table had zero rows; the message names no row, but the first unknown country sits on row 102. The generated page did the same under Stop.</p><p>So: a staging table with every column as text and the line number kept.</p><pre>create table xl_orders_stage (<br>  line_no number, order_no varchar2(4000), order_date varchar2(4000), customer varchar2(4000),<br>  country varchar2(4000), amount varchar2(4000), qty varchar2(4000), status varchar2(4000),<br>  notes varchar2(4000), load_error varchar2(4000)<br>);<br> <br>truncate table xl_orders_stage;<br>insert into xl_orders_stage (line_no, order_no, order_date, customer, country, amount, qty, status, notes)<br>select p.line_number, p.col001, p.col002, p.col003, p.col004, p.col005, p.col006, p.col007, p.col008<br>  from xl_files f, table(apex_data_parser.parse(p_content =&gt; f.content, p_file_name =&gt; f.file_name)) p<br> where f.file_name = &#39;orders.xlsx&#39; and p.line_number &gt; 1;</pre><p>Clear the stage before every load, or add a load ID column and filter on it, so that yesterday’s rows never reach today’s merge. Then one update per rule, each writing the message a user can act on. VALIDATE_CONVERSION (Oracle 12.2 and later) is the function that makes this short:</p><pre>update xl_orders_stage s set load_error = &#39;Order No is not a number&#39;<br> where load_error is null and (order_no is null or validate_conversion(order_no as number) = 0);<br>update xl_orders_stage s set load_error = &#39;Order Date is not a date in the form YYYY-MM-DD: &#39; || order_date<br> where load_error is null and (order_date is null or validate_conversion(order_date as date, &#39;YYYY-MM-DD&#39;) = 0);<br>update xl_orders_stage s set load_error = &#39;Customer is empty&#39;<br> where load_error is null and customer is null;<br>update xl_orders_stage s set load_error = &#39;Country not in the country list: &#39; || country<br> where load_error is null and not exists (select 1 from xl_countries c where c.country_name = s.country);<br>update xl_orders_stage s set load_error = &#39;Amount is empty&#39;<br> where load_error is null and amount is null;<br>update xl_orders_stage s set load_error = &#39;Amount is not a number: &#39; || amount<br> where load_error is null and validate_conversion(amount as number) = 0;<br>update xl_orders_stage s set load_error = &#39;Qty is not a number: &#39; || qty<br> where load_error is null and qty is not null and validate_conversion(qty as number) = 0;<br>update xl_orders_stage s set load_error = &#39;Status must be NEW, PAID, SHIPPED or CANCELLED: &#39; || status<br> where load_error is null and (status is null or upper(trim(status)) not in (&#39;NEW&#39;,&#39;PAID&#39;,&#39;SHIPPED&#39;,&#39;CANCELLED&#39;));<br>update xl_orders_stage s set load_error = &#39;Order No appears more than once in the file: &#39; || order_no<br> where load_error is null and order_no in (select order_no from xl_orders_stage group by order_no having count(*) &gt; 1);</pre><p>These rules cover the problems I planted, and they repeat what the table’s constraints enforce anyway, on purpose: the constraint still rejects a bad row, the rule says why in plain words first. The last rule looks at two rows at once. The same order number twice in one sheet reaches the merge as two source rows, and in a small test that raised ORA-00001 when the number was new and ORA-30926 when it already existed; marking both rows in the stage names the two rows for the user.</p><p>Run against the 5,000 rows, nine were marked: “Amount is empty” four times, “Country not in the country list” for UK, Viet Nam and USA, “Amount is not a number: 1,234.50” and “Order Date is not a date in the form YYYY-MM-DD: 15/03/2026”. The six lower-case statuses passed, because the rule upper-cases before it checks, and the merge does the same:</p><pre>merge into xl_orders t<br>using (select to_number(s.order_no) order_no, to_date(s.order_date, &#39;YYYY-MM-DD&#39;) order_date,<br>              s.customer, c.country_id, to_number(s.amount) amount, to_number(s.qty) qty,<br>              upper(trim(s.status)) status, s.notes<br>         from xl_orders_stage s join xl_countries c on c.country_name = s.country<br>        where s.load_error is null) src<br>on (t.order_no = src.order_no)<br>when matched then update set t.order_date = src.order_date, t.customer = src.customer,<br>                             t.country_id = src.country_id, t.amount = src.amount,<br>                             t.qty = src.qty, t.status = src.status, t.notes = src.notes<br>when not matched then insert (order_no, order_date, customer, country_id, amount, qty, status, notes)<br>                      values (src.order_no, src.order_date, src.customer, src.country_id,<br>                              src.amount, src.qty, src.status, src.notes);</pre><p>4,991 rows merged. A report on XL_ORDERS_STAGE WHERE LOAD_ERROR IS NOT NULL is the error report the upload page needs, in words the person who owns the spreadsheet understands, with the line number they can scroll to.</p><p>The update workbook is why the last step is a merge. A plain insert of its 50 rows failed on the first one: “ORA-00001: unique constraint (DEMO2.SYS_C0014227) violated on table DEMO2.XL_ORDERS columns (ORDER_NO)”, with the detail line “row with column values (ORDER_NO:10001) already exists”. The same 50 rows through the stage (cleared first) and the merge: 50 rows merged, 30 updated, 20 inserted, 5,011 in the table.</p><h3>Step 5: The CSV traps, and which ones still exist</h3><p>The forum threads are mostly about CSV, so I made four: a semicolon-delimited file with a decimal comma (what a European Excel writes), a UTF-8 file with a byte order mark (Excel’s “CSV UTF-8”), a Windows-1252 file with “Café Zoë Pâtisserie” in it, and the file with the wrong field counts from Step 1.</p><ul><li><strong>Semicolon and decimal comma.</strong> The parser detected the semicolon by itself; the Data Workshop did too and ticked “;” in its delimiter picker. The decimal comma is different: the parser returned 3198,24 as text, and returned it unchanged with p_decimal_char =&gt; &#39;,&#39; too; DISCOVER typed the column NUMBER either way. Converting it is your job: to_number(col005, &#39;999999999D99&#39;, &#39;NLS_NUMERIC_CHARACTERS=&#39;&#39;,.&#39;&#39;&#39;) gave 3198.24, and so did to_number(replace(col005, &#39;,&#39;, &#39;.&#39;)), which only works while the file has no thousands separators. The Data Workshop detected the comma as the decimal character and loaded 3198.24.</li><li><strong>Byte order mark.</strong> Did not reproduce. The parser’s first header came back as Order No, eight characters, no stray bytes, and DISCOVER named the column ORDER_NO. The 26.2 parser stripped it.</li><li><strong>Windows-1252.</strong> The parser assumed UTF-8 and returned “Caf” followed by garbage; p_file_charset =&gt; &#39;WE8MSWIN1252&#39; returned the name intact. DISCOVER guessed AL32UTF8 for the file, so the profile will not save you here. The Data Workshop guessed Western European ISO-8859-1 on its own and the name was stored correctly.</li><li><strong>Field counts.</strong> Neither tool raises an error. The parser put the ninth field of the long row in COL009 and left the short row&#39;s last two columns NULL; DISCOVER added a ninth column to the profile.</li></ul><p>Not tested here: CSV files over 50 MB (the package’s own notes say those are parsed from the original LOB instead of in memory) and large .xlsx files of any kind, a workbook saved by Excel itself rather than by my script (other date formats, formulas), the Replace method in either tool, the Copy and Paste source, and a collection as the load target.</p><h3>Which path, when</h3><ul><li><strong>A one-off load by a developer</strong>, such as reference data or a migration: the Data Workshop. Check the <em>Columns to Load</em> tab before clicking Load, and read the error table afterwards.</li><li><strong>A repeating load by users of your app</strong> where the sheet’s columns match the table or a lookup and an upper-case rule close the gap: a Data Load Definition and its page. Set <em>When on Error</em> to Log Error into Collection with a name, add a report on the collection, and decide Append or Merge on purpose.</li><li><strong>Anything with rules a user has to be told about</strong>, a second sheet, a header that moves, a number format that changes with the sender’s locale: the parser into a staging table, your validation in SQL, and a merge.</li></ul><h3>What to keep</h3><p>The workbook that arrives next month will not be the one you tested with. When a row cannot load, the Data Workshop puts it in an error table with the ORA text, the generated page set to log counts it, and the staging route names the row and the rule in words. For a workbook someone else sends, the last one is the answer a user can act on.</p><p>So the rule I keep: load into a staging table, validate there, merge into the real table, and keep the constraints in the database, where the check on STATUS and the foreign key on COUNTRY_ID already are. The page only displays the message.</p><p>Two other APEX posts of mine: <a href="https://medium.com/@syanzen/oracle-apex-data-source-report-c0ea8f7d05cc">Oracle APEX — Data Source &amp; Report</a>, from 2024, on where a report’s rows come from and which report type to pick, and <a href="https://medium.com/@syanzen/oracle-apex-connect-claude-code-to-your-database-with-the-sqlcl-mcp-server-ec81769b09a4">Oracle APEX — Connect Claude Code to Your Database with the SQLcl MCP Server</a>, the setup for letting Claude Code work against an APEX database; the queries here ran as SQLcl scripts.</p><p><em>This article shows the loads. The decisions behind APEX, one standard, one decision rule and one gotcha for every layer, are in </em><a href="https://grumpypunch.gumroad.com/l/opinionated-apex/MEDIUMAPEX"><em>Opinionated APEX</em></a><em>: $19, or $17 for Medium readers through that link.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b4c4c935199" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Fable 5.2 vs Opus 5.5 in Claude Code: Eight Coding Tasks, Measured]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@syanzen/claude-fable-5-2-vs-opus-5-5-ee9a17c499fd?source=rss-f82d26333b2c------2"><img src="https://cdn-images-1.medium.com/max/1500/1*dWB9yypIQW2BaEK7k3UBWg.jpeg" width="1500"></a></p><p class="medium-feed-snippet">I gave Claude Fable 5.2 and Claude Opus 5.5 the same eight coding tasks with hidden tests in Claude Code, both at high effort. Both passed&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@syanzen/claude-fable-5-2-vs-opus-5-5-ee9a17c499fd?source=rss-f82d26333b2c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@syanzen/claude-fable-5-2-vs-opus-5-5-ee9a17c499fd?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee9a17c499fd</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Fri, 13 Nov 2026 01:23:59 GMT</pubDate>
            <atom:updated>2026-11-13T01:23:59.939Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Make Claude Code Less Verbose: CLAUDE.md Rules Tested on Output Tokens]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@syanzen/claude-code-less-verbose-34af6c4cf193?source=rss-f82d26333b2c------2"><img src="https://cdn-images-1.medium.com/max/1500/1*9MgYmVW_Np6agiybSDTxQA.jpeg" width="1500"></a></p><p class="medium-feed-snippet">I put three CLAUDE.md rules, and no file at all, in front of 48 Claude Code runs of six coding tasks with hidden tests. &#x201C;Be concise.&#x201D; cut&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@syanzen/claude-code-less-verbose-34af6c4cf193?source=rss-f82d26333b2c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@syanzen/claude-code-less-verbose-34af6c4cf193?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/34af6c4cf193</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-12T00:01:02.231Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Claude Code Effort Levels: Low vs Medium vs High vs xhigh vs Max, Measured]]></title>
            <link>https://medium.com/@syanzen/claude-code-effort-levels-8d6ee975d14f?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d6ee975d14f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[developer-tools]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Wed, 11 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-12T10:11:20.585Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>I gave Claude Opus 5.5 six small coding tasks with hidden tests at all five effort levels Claude Code offers, 30 runs. Every level passed every test. Low took a median 33 seconds a task and cost eight cents. Max took 503 seconds and $1.39, with 340 times the thinking tokens, and spent the difference building test labs.</em></h4><p><em>How this was made: a Claude Code session on my Mac designed the tasks and their hidden tests, ran the experiment through Claude Code’s print mode, scored the results by script, and drafted this piece with me.</em></p><figure><img alt="A graphite-blue robot turns a large gold dial with five plain notches on a warm off-white wall; above the dial, five coral-orange thought clouds rise in a row, the first tiny and the last filling the top corner of the frame." src="https://cdn-images-1.medium.com/max/1024/1*EfyFGHtZeGPLkR8y6JOiBQ.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><p>In late October, typing “claude code effort” into Google offered “effort levels explained”, “medium vs high” and “xhigh vs max”. The results were an SEO site, aggregators in six languages, an opinion piece, and <a href="https://wmedia.es/en/tips/claude-code-effort-level-medium-high-xhigh">one measured test</a> from October 2026 that ran three PHP tasks at medium, high and xhigh and found every run passed at all three levels. <a href="https://gabrielmoraru.com/opus-5-xhigh-vs-max-effort/">One writer</a> compared xhigh and max for Opus 5 by reading values off Anthropic’s published charts.</p><p>Anthropic’s <a href="https://platform.claude.com/docs/en/build-with-claude/effort">effort page</a> describes the top level as “absolute maximum capability with no constraints on token spending”, the level below it as “extended capability for long-horizon work” meant for agentic tasks “over 30 minutes” with “token budgets in the millions”, says that on Opus 5.5 “effort is the primary control for how much the model reasons and what a request costs”, and, in the same Opus 5.5 section, tells you to “run an effort sweep on your own evals rather than carrying settings over from an earlier model”.</p><p>So I ran a sweep, all five levels, on the current model.</p><h3>What I did</h3><p>Six small coding tasks, each with a hidden test that decides pass or fail with no judgement from me:</p><ul><li><strong>A parser:</strong> implement parse_kv from a docstring with eight rules (quoted values, two escapes, an int rule) and six error cases.</li><li><strong>A date calculation:</strong> add_business_days with weekends, holidays, negative counts, a leap day and a year end.</li><li><strong>A refactor:</strong> split a 72-line process_order into three functions without changing one byte of its output on fourteen orders.</li><li><strong>A bug with a misleading error message:</strong> a report script that says the data file is corrupted with a checksum mismatch and tells you to re-download it. The file is fine. The script reads it with the wrong delimiter, parses day-first dates as month-first (so sixteen of the 42 rows would land silently in the wrong month), and trips on a blank line.</li><li><strong>A SQL query:</strong> the top customer by 2025 revenue per region in SQLite, with a tie, a cancelled order that would win if counted, a list price that differs from the price charged, and a 2024 order on the boundary.</li><li><strong>Two shell scripts:</strong> the top three IPs by 5xx responses in an Apache log seeded with 500s in byte counts, paths, referrers and user agents, and four lines whose request field is just &quot;-&quot;, two of them 500s, so the status is not the ninth field; plus a script that prunes rotated logs older than 30 days and must leave the live log alone.</li></ul><p>Each task ran through Claude Code’s print mode (claude -p: one prompt in, one result out, no interactive session) on Claude Opus 5.5 with the file and shell tools allowed without prompts, in a fresh copy of the task folder. The effort was pinned on every call with --effort, and the environment stripped so the setting from my own session could not leak in. A script then ran the hidden test on the files the model left behind, read the CLI&#39;s own report of cost, output tokens and thinking tokens, and timed the process itself.</p><p>I had planned two runs per task per level. The first twelve runs, one of each task at medium and at max, cost $9.07 of a $10 budget, so with the budget raised to about $15 the rest ran once each: six tasks, five levels, 30 runs, $12.04 of plan usage in all.</p><h3>What happened</h3><p>Every level passed every task: 30 of 30. Per level, medians over the six tasks, and the mean cost of a run:</p><h4>Low:</h4><p>33 seconds a task, 116 thinking tokens, 1,600 output tokens, $0.08 a run.</p><h4>Medium:</h4><p>46 seconds, 374 thinking tokens, 2,700 output tokens, $0.12.</p><h4>High:</h4><p>54 seconds, 709 thinking tokens, 3,700 output tokens, $0.15.</p><h4>xhigh:</h4><p>71 seconds, 2,400 thinking tokens, 6,000 output tokens, $0.26.</p><h4>Max:</h4><p>503 seconds, 39,000 thinking tokens, 47,000 output tokens, $1.39.</p><p>From low to xhigh the curve is gentle: each step adds eight to eighteen seconds to the median and two to twelve cents to the mean, and xhigh costs about 1.8 times what high does. The step from xhigh to max adds seven minutes a task and multiplies the cost by five. Against low, max is 15 times the wait, sixteen and a half times the cost and 340 times the thinking tokens, for the same six passes.</p><p>The range by task is wide. The shell scripts took 51 seconds at low and 1,100 seconds, eighteen minutes, at max; the date function took 22 seconds and 790. The cheapest max run was $0.67 (the misleading-error bug) and the dearest $2.47 (the shell scripts). At xhigh the shell task was the one outlier, 229 seconds and 14,000 thinking tokens; the other five tasks at xhigh ran in 41 to 110 seconds.</p><p>The one earlier test I could find lines up with this. On three PHP tasks, the median cost at medium, high and xhigh was $0.18, $0.22 and $0.38 a run, a ratio of 1 to 1.2 to 2.1. My mean costs give the same ratio to one decimal, 1 to 1.19 to 2.11 before rounding; my medians, $0.11, $0.15 and $0.20, give 1 to 1.4 to 1.9.</p><h3>Where eighteen minutes went</h3><p>The protocol’s planned read was of tasks a lower level had failed. There were none, so I read nine transcripts across three tasks instead, three on the bug, four on the shell scripts and two on the date function, to see what the higher levels did with the extra time, and then scanned all 30 for commands that failed and for edits made after a self-test.</p><p>On the misleading-error bug, low found all three causes, the semicolons, the day-first dates and the blank lines, in two commands: one dumped the script and the first bytes of the file, the next counted how many first fields exceeded twelve (23 rows) and how many second fields did (none). It patched the script, checked the totals against an independent awk, and finished in 34 seconds with 109 thinking tokens. Medium did the same in two commands, a hex dump and then a cat -A that showed the blank lines, in 38 seconds. Max named the same three causes after a byte profile of the whole file, then recomputed every total with Decimal, tested the error path on a deliberately broken copy, and, unprompted, wrote a note into Claude Code&#39;s memory folder for &quot;future sessions&quot; saying the supplier&#39;s file must never be edited. Three and a half minutes.</p><p>On the shell scripts, low counted the fields per line first (44 lines had sixteen, ten had fewer), wrote a sed pattern that takes the status as the token after the request’s closing quote, then cross-checked the counts with an awk that split each line on the quote marks; 51 seconds. Medium located the status structurally, after the closing quote, in its first draft; the draft itself did not run on macOS awk (a -- it passed as an argument was read as a filename) and it fixed that with one sed; 67 seconds. xhigh wrote the same kind of script, then built an edge-case log with spaces in paths and an IPv6 address and a prune fixture with files either side of the 30-day line; 229 seconds. Max saw the &quot;-&quot; trap in its first look (&quot;tricky cases like &quot;-&quot; requests shifting field numbers”), then checked whether gawk, mawk, GNU find, Docker and Podman were installed, hand-counted the expected top three before running its own script, generated 300 random logs with a Python script and compared its awk against the ground truth on each, built a fixture for the prune script with a symlink, a hidden file, a named pipe, a file with a newline in its name and one called -dash.log.1, fed the log script a file called -x.log, timed the parse on a million lines, and cleaned up its temp directories. Eighteen minutes.</p><p>On the date function, medium read the docstring, wrote a function of sixteen code lines with a four-line loop that steps through the days one at a time, ran the docstring examples and six dates of its own, and stopped, in 30 seconds. Max first proved to itself that ordinal 1 is a Monday so it could compute weekdays arithmetically instead of looping, then wrote a separate verification script that ran 36 hand-worked cases, 48,678 cases in windows around month and year ends, 100,000 random cases and 14,640 cases near the limits of Python’s date range, then timed the function with 80,000 holidays, saw a number it called “superlinear”, profiled each phase, concluded the reading had been noise from a busy machine, and edited the file once more. Thirteen minutes, and a 101-line file with 46 lines of code, against medium’s 48-line file with sixteen inside the function. The hidden test has ten cases.</p><p>That is a read of transcripts, not a score. In the nine, the higher level found the same clue as the lower one and then built a test lab around it, and the scan of all 30 found no run that produced a wrong answer and corrected it later. Two first attempts did not run: medium’s shell script, whose awk call failed on macOS awk and would have failed the hidden test had medium not run it itself, and high’s own shell-quoted test on the parser, where the parser was fine and the test string was not. The scan also showed what the refactor transcripts held: medium compared old and new on 200,000 random orders, and high and xhigh added a second randomised pass over valid orders; high built a dated prune fixture on the shell task. The docs’ warning that max “can lead to overthinking”, written for Opus 4.7, looked like this on 5.5: a thirteen-minute profiling detour on the date function.</p><p>Max looked for a memory note before it started on the bug task, the run that then wrote one, and again on the parser task: two runs in 30 looked, one wrote. Claude Code’s auto-memory was on in these print-mode runs, and a second run in the same folder would have read that note. Each run had its own folder, so none read another’s; I emptied the memory folders before the last eighteen runs anyway.</p><h3>What I’d do</h3><p>For a task like these, small, well specified, with a check the model can run itself, low passed all six in a median half-minute each, and medium, the default on Opus 5.5, in three quarters of a minute. I’d leave the default alone: low’s saving is 13 seconds and four cents a task, and six runs can’t tell me whether low fails one time in ten. I wouldn’t reach for high on a task of this shape either.</p><p>High and xhigh add the fixtures and second pass above to what medium already ran. On these six tasks that testing confirmed code that was already right, at 1.2 and 2.1 times the cost of medium and about a minute a task. If a wrong answer is expensive and you can’t write the test yourself, that is what the step buys, though nothing here tested whether those fixtures would catch a real bug.</p><p>Max buys a test lab and a long wait: six to eighteen minutes on four of the six tasks here, and 100,000 random cases on a function medium had checked on the docstring examples and six dates of its own. The docs pitch max at “the deepest possible reasoning”; mine took half a minute and 116 thinking tokens at low, so the 340 is partly a small denominator, and the 39,000 tokens max spent on the same tasks are large on their own. On a task that needs that kind of thinking, max may earn it; this test can’t say, because nothing in it was hard enough to fail.</p><p><em>Method. Claude Code CLI 2.1.317 in print mode on 7 November 2026 (+08), default system prompt, tools Read, Write, Edit, Bash, Glob and Grep allowed without prompts, maximum 40 turns, environment stripped to PATH, HOME, USER, LOGNAME, LANG, TMPDIR and SHELL, </em><em>--effort pinned per call, Claude Opus 5.5 throughout. Output tokens include the thinking tokens; ratios are taken from the unrounded figures, so they can differ in the last digit from ratios of the rounded figures in the body (low’s mean cost is $0.084). Wall clock is the runner’s measurement of the CLI process with three runs in flight at once: comparable within each block of runs (medium and max ran together, then low, high and xhigh), less so between the blocks, and not absolute. Cost is the CLI’s own total_cost_usd, list-price equivalent on a Max plan: plan usage, not a bill. The six tasks, their hidden tests and the predictions were sealed by hash before the first of the 30 runs, along with a budget rule whose fallback, a Sonnet 5.5 second rep for max, I did not use. The predictions were wrong in the direction that matters: they put the pass rate at 55 to 75 percent at low, rising with effort, and every level passed everything; they put max at 2.5 to 4 times the cost of medium and 2 to 4 times the wall clock of low, and it was 11 and 15 times; and they predicted the higher level would name the real cause while the lower patched the symptom, and every level read named the cause before editing. The tests check correctness; they say nothing about code quality.</em></p><p><em>The same six tasks with three CLAUDE.md rules for shorter output: </em><a href="https://medium.com/@syanzen/claude-code-less-verbose-34af6c4cf193"><em>How to Make Claude Code Less Verbose: CLAUDE.md Rules Tested on Output Tokens</em></a><em>. What a long CLAUDE.md costs, measured: </em><a href="https://medium.com/@syanzen/claude-md-too-long-48d71440627d"><em>Is Your CLAUDE.md Too Long? I Tested Claude Code at 14 to 1,600 Lines. It Followed Every Rule.</em></a><em> For chat answers rather than code: </em><a href="https://medium.com/@syanzen/how-to-make-claude-stop-over-explaining-f534f8af2618"><em>How to Make Claude Stop Over-Explaining</em></a><em>.</em></p><p><em>Whether a model that thinks 340 times as much is reasoning 340 times better is the question my short book is about: 15 cases that check an AI’s reasoning, not just its answer. Medium readers get it for $5 instead of $7 → </em><a href="https://grumpypunch.gumroad.com/l/your-ai-got-lucky/MEDIUMAI5"><em>Your AI Got Lucky</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d6ee975d14f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle APEX — Mail Queue Stuck: Fix Emails Not Sending]]></title>
            <link>https://medium.com/@syanzen/oracle-apex-mail-queue-stuck-ccebf8fd1236?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccebf8fd1236</guid>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[plsql]]></category>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[oracle-apex]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-10T00:01:02.055Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>What a stuck APEX mail queue looks like on 26.2, the one call that names the fault, the retry schedule the queue page computes and the docs do not mention, and the twelve ways I broke it on purpose. Every row here was read back from the APEX views.</em></h4><p><em>How this was made: I wrote this with Claude Code. A Claude Code session on my Mac stood up a throwaway mail server next to a throwaway APEX 26.2 database, changed one setting at a time, pushed the queue and read the queue, the log and the scheduler views after each change. I made the calls; the database test passwords were generated into a locked folder and never typed into the chat, and the mail server’s login was a throwaway test value.</em></p><figure><img alt="A small coral-orange robot looks into a slate-gray mail slot where a neat stack of pale envelopes waits, none of them moving; a deep red database cylinder with a thin gold band stands behind it with its light on." src="https://cdn-images-1.medium.com/max/1024/1*RU8iHUv9xJXwl70z7Woz5g.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><p>Someone types “oracle apex mail queue stuck” into Google and gets a page of forum threads, from APEX 4 to a 2025 post about Autonomous Database, most of them without an answer. Mail sits in the queue with a send count of zero. Nobody can say why. The one fix that comes up more than once is from 2015: stop the scheduler job, drop it, create it again.</p><p>I ran the whole thing on a fresh APEX 26.2 instance with a throwaway SMTP server beside it, and broke it twelve different ways. The queue was silent for eight of them, six that failed at or before the login and two where the job itself was the problem, which is why the threads have no answer: in those cases the engine writes nothing to the queue, the place everyone looks. This is what it does today, read from its own views.</p><h3>The short version</h3><ul><li>A failure at or before the SMTP login (no network ACL, wrong host, wrong port, wrong TLS mode, wrong password) leaves every queued row exactly as it was: send count 0, no error text, and the scheduler job reports success. This is the “stuck” the forum threads describe.</li><li>APEX_INSTANCE_ADMIN.VALIDATE_EMAIL_CONFIG reproduces that stage and raises the real error. It is the first thing to run, and it was the only place in my tests that told ORA-24247 from ORA-29278.</li><li>A failure once the server has accepted the connection (authentication required, recipient rejected, bad address) writes the error and a send count to the row, and the row waits. The wait is 2 minutes after the first failure, then 4, 8, 16: the next retry is the last update plus 2 to the power of the send count, in minutes.</li><li>APEX_MAIL.PUSH_QUEUE and the &quot;Send All Mail&quot; button honour that wait. &quot;Force Send All Mail&quot; does not. The job itself runs every 5 minutes on 26.2.</li><li>A fresh install has no network ACL for the APEX schema at all. The default host is localhost on port 25. Both have to change before the first message leaves.</li><li>A server that accepts the connection and never answers leaves the job in RUNNING for as long as you let it: 16 minutes in my test, no timeout, no error, and the next scheduled runs do not start. DBMS_SCHEDULER.STOP_JOB with force ends it; nothing needs dropping.</li></ul><h3>What you need</h3><p>APEX 26.2 (the retry formula and the admin pages may differ on older versions), an Administration Services login, a SYSDBA or DBA connection for the ACL and the scheduler views, and somewhere for the mail to go. I used Mailpit, a one-container SMTP server with a web inbox, on the same Docker network as the database:</p><pre>docker network create mailnet<br>docker network connect mailnet apexdemo<br>docker run -d --name mailpit --network mailnet -p 127.0.0.1:8025:8025 -p 127.0.0.1:1025:1025 axllent/mailpit</pre><p>apexdemo is my database container; use the name of yours. The database reaches Mailpit as mailpit on port 1025; the inbox is at localhost:8025. Everything below works the same against a real relay, with the real host and port in place of those.</p><h3>Step 1: Make it work once</h3><p>Three things stand between a fresh 26.2 install and its first email, and the install tells you about none of them.</p><p><strong>The instance settings.</strong> Administration Services → Manage Instance → Instance Settings → Email. On a fresh install the host is localhost, the port is 25, Use SSL/TLS is No, and the from address is blank. From SQL, as a user with APEX_ADMINISTRATOR_ROLE:</p><pre>begin<br>  apex_instance_admin.set_parameter(&#39;SMTP_HOST_ADDRESS&#39;, &#39;mailpit&#39;);<br>  apex_instance_admin.set_parameter(&#39;SMTP_HOST_PORT&#39;, &#39;1025&#39;);<br>  commit;<br>end;</pre><figure><img alt="The Email section of APEX instance settings with SMTP Host Address mailpit, SMTP Host Port 1025, empty username and password, Use SSL/TLS set to No, an empty default from address and Maximum Emails per Workspace 1000." src="https://cdn-images-1.medium.com/max/1024/1*yFh2Pwb-Qd7cBZHl-Cd6aw.png" /><figcaption>The Email section of Instance Settings, after Step 1. On a fresh install the host reads localhost and the port 25.</figcaption></figure><p><strong>The network ACL.</strong> The APEX schema (APEX_260200 on 26.2) needs the connect privilege to the mail host. On my fresh install there was no ACL for it at all; the only entry in DBA_HOST_ACES was an internal one. As SYSDBA:</p><pre>begin<br>  dbms_network_acl_admin.append_host_ace(<br>    host       =&gt; &#39;mailpit&#39;,<br>    lower_port =&gt; 1025,<br>    upper_port =&gt; 1025,<br>    ace        =&gt; xs$ace_type(privilege_list =&gt; xs$name_list(&#39;connect&#39;),<br>                              principal_name =&gt; &#39;APEX_260200&#39;,<br>                              principal_type =&gt; xs_acl.ptype_db));<br>  commit;<br>end;</pre><p>The ACL must cover the host and port in the instance settings; an ACE with no port at all also works, and a range should by its definition, though I did not try one. Narrow it to one port, change the port later, and the ACL silently stops matching; that case is in Step 4.</p><p><strong>The send.</strong> From a page process, an automation, or SQL after apex_session.create_session (I used app 100, page 1 and a workspace user):</p><pre>begin<br>  apex_mail.send(p_to   =&gt; &#39;reader@example.com&#39;,<br>                 p_from =&gt; &#39;apex@example.com&#39;,<br>                 p_subj =&gt; &#39;Test&#39;,<br>                 p_body =&gt; &#39;Hello from the queue.&#39;);<br>  commit;<br>  apex_mail.push_queue;<br>end;</pre><p>APEX_MAIL.SEND only writes a row. PUSH_QUEUE starts a run of the scheduler job right then (the run appeared in the job history at the same second as my call); without it the job&#39;s own schedule picks the row up within 5 minutes. My first message, created at 13:05 while the settings were still wrong, arrived at 13:13:53, a few seconds after the last fix.</p><h3>Step 2: Where to look</h3><p>Four places, and each one answers a different question.</p><p><strong>APEX_MAIL_QUEUE</strong> is what is waiting. The columns that matter are MAIL_SEND_COUNT, MAIL_SEND_ERROR, MAIL_MESSAGE_CREATED and LAST_UPDATED_ON. A row leaves this view the moment it is sent, or the moment the engine gives up on it.</p><pre>select id, mail_to, mail_subj, mail_send_count, mail_send_error,<br>       mail_message_created, last_updated_on,<br>       case when mail_send_count &gt; 0<br>            then last_updated_on + power(2, mail_send_count) / 1440 end as next_retry_on<br>  from apex_mail_queue<br> order by mail_message_created;</pre><p>That last column is not in the view. I copied the formula from the query behind the Mail Queue admin page, where it is the “Next Retry On” column; Step 5 walks through the schedule it produces.</p><p><strong>APEX_MAIL_LOG</strong> is what has left the queue, sent or not. MAIL_MESSAGE_SEND_BEGIN, MAIL_MESSAGE_SEND_END and an empty MAIL_SEND_ERROR mean delivered to the server; an error here means the engine gave up (Step 5 says when it does).</p><p><strong>The scheduler job</strong> is ORACLE_APEX_MAIL_QUEUE, owned by the APEX schema, and it calls WWV_FLOW_MAIL.PUSH_QUEUE_IMMEDIATE. On 26.2 its schedule is every 5 minutes, on the minute. As a DBA:</p><pre>select job_name, enabled, state, last_start_date, next_run_date, repeat_interval<br>  from dba_scheduler_jobs<br> where owner = &#39;APEX_260200&#39; and job_name = &#39;ORACLE_APEX_MAIL_QUEUE&#39;;<br> <br>select actual_start_date, status, run_duration, additional_info<br>  from dba_scheduler_job_run_details<br> where job_name = &#39;ORACLE_APEX_MAIL_QUEUE&#39;<br> order by actual_start_date desc<br> fetch first 10 rows only;</pre><p>In every failing case in Step 4 that produced a run, apart from the hanging server, the run said SUCCEEDED in a second or less. A clean job history is not evidence that mail is going out.</p><p><strong>The admin pages.</strong> Manage Instance → Mail Queue shows the same rows with the Next Retry On column and three buttons: Delete, Send All Mail and Force Send All Mail. It has four more tabs on 26.2 (a metrics dashboard, an “Operational &amp; Triage” view with a report of mail that took over 5 minutes, trending, monitoring). The Mail Log link at the foot of that page is the log view, with a Truncate button.</p><figure><img alt="The Mail Queue Overview report in APEX Administration Services with one row for workspace DEMO, created 1:05:22 PM, queue age 2.70 minutes, an empty Mail Send Error, Mail Send Count 0 and an empty Next Retry On." src="https://cdn-images-1.medium.com/max/1024/1*bH28MjRTxtCfwUb1ga7kSw.png" /><figcaption>The forum thread, reproduced: one message, a send count of 0, no error, no retry time. The instance had no network ACL.</figcaption></figure><h3>Step 3: The one call that names the fault</h3><pre>begin<br>  apex_instance_admin.validate_email_config;<br>end;</pre><p>It opens a connection to the configured host with the configured TLS mode and credentials, and raises whatever goes wrong. Run it in a fresh session as the administrator user, before anything has created an APEX session in that connection (after APEX_SESSION.CREATE_SESSION it refuses with ORA-20987, &quot;requires ADMIN privilege&quot;, as does SET_PARAMETER). What it said for each of my breakages is in Step 4.</p><p>What it does not do: send a message. A server that wants authentication while the instance has no username passed the check and then rejected every message. Pass the check, then push the queue and read the row.</p><h3>Step 4: Twelve ways to break it, one at a time</h3><p>Each case starts from the working setup in Step 1, changes one thing, queues a message, pushes or waits for the next run, and reads the queue. The cases fall into three groups by where they fail.</p><p><strong>Group A: at or before the login. The queue says nothing.</strong> In all six the row kept send count 0 and an empty error, the job run said SUCCEEDED, and the message waited until I put the setting back. Only VALIDATE_EMAIL_CONFIG had anything to say.</p><ul><li>No ACL (the fresh-install state), or an ACL that does not cover the configured host or port: ORA-24247: network access denied by access control list (ACL). Changing the port from 1025 to 2525 with the ACL still on 1025 gave the same error, which is the easy way to break a working instance.</li><li>A host that does not exist, with an ACL for it: ORA-29278: SMTP transient error: 421 Service not available.</li><li>A port nothing listens on, with an ACL for it: the same ORA-29278, 421. The error does not tell a wrong name from a wrong port.</li><li>Use SSL/TLS set to Yes (SMTP_TLS_MODE = Y, encrypt from the first byte) against a plain port: ORA-29019: The protocol version is incorrect.</li><li>SMTP_TLS_MODE = STARTTLS against a server that does not offer it: ORA-29279: SMTP permanent error: 502 5.5.1 Command not implemented. The parameter takes Y, N or STARTTLS; anything else is refused when you set it.</li><li>A wrong password: ORA-29279: SMTP permanent error: 535 5.7.8 Authentication credentials invalid. The row stayed at send count 0 here too, because the login fails before any message is read.</li></ul><p><strong>Group B: once the server has accepted the connection. The row carries the error and waits.</strong> Here the engine reached the server, got through the greeting, and was refused on the message. The row got MAIL_SEND_COUNT 1, the server&#39;s reply in MAIL_SEND_ERROR, and a retry time.</p><ul><li>The server requires authentication and the instance has no username: ORA-29279: SMTP permanent error: 530 5.7.0 Authentication required. This is the case the validation call passes.</li><li>A recipient the server rejects: ORA-29279: SMTP permanent error: 550 5.1.0 Requested action not taken: mailbox unavailable.</li><li>A from address without a domain (p_from =&gt; &#39;nobody&#39;), or a recipient that is not an address at all: ORA-29279: SMTP permanent error: 553 5.1.3 The address is not a valid RFC 5321 address. APEX_MAIL.SEND accepted both without complaint; the server did the checking. A null p_from with no default from address at the instance went out with an empty sender, which my test server accepted and a real one probably will not; I did not test that.</li></ul><figure><img alt="The Mail Queue Overview report with three rows for workspace DEMO showing SMTP permanent errors 553 and 550, Mail Send Counts of 2, 3 and 2, and Next Retry On times of 1:39:00 PM, 1:43:00 PM and 1:39:00 PM." src="https://cdn-images-1.medium.com/max/1024/1*WUduz92lZQXyGoyqXqsEug.png" /><figcaption>Group B. Three messages the server refused, each with the reply, the send count and the time of the next attempt.</figcaption></figure><p><strong>Group C: the job itself.</strong></p><ul><li>A server that accepts the connection and never speaks. I pointed the instance at a listener that did exactly that. The job went to RUNNING, its session sat on the wait event “TCP Socket (KGAS)”, the 13:40 scheduled run never started while the 13:38 one was still going, and after 16 minutes nothing had timed out. A push 27 seconds in returned normally and did nothing. The threads call this “the job is stuck in RUNNING”, and the fix is in Step 6.</li><li>The job disabled, which a DBA may do during an incident and then forget. With ORACLE_APEX_MAIL_QUEUE disabled, two messages sat through a scheduled slot untouched: send count 0, no error, and no run in the job history. But APEX_MAIL.PUSH_QUEUE still delivered: in a first attempt I pushed right after queuing, both messages went out that second, and a run appeared in the history with the job still disabled. So a report that mail only goes out when someone calls push points at a disabled job. Enabling it again started nothing by itself; the next 5-minute slot drained the queue.</li><li>The workspace limit. WORKSPACE_EMAIL_MAXIMUM is 1000 messages per workspace per 24 hours by default, and the queued rows count toward it, not only the sent ones: with 7 in the log and 1 in the queue and the limit set to 9, the next SEND went through and the one after it raised ORA-20001: You have exceeded the maximum number of email messages per workspace. Please contact your administrator. This one fails at SEND, in the page, not in the queue.</li></ul><p>Reported in the threads and not reproduced here: ORA-30678 (too many open connections) and ORA-06502 from the queue job. I have no evidence either way on 26.2.</p><h3>Step 5: The retry schedule, and the two buttons</h3><p>The engine retries a Group B row at LAST_UPDATED_ON plus 2 to the power of MAIL_SEND_COUNT minutes. I watched one rejected recipient: failed at 13:27:45, retried by the 13:30 run (count 2, next retry 13:34), by the 13:35 run (count 3, next 13:43), then forced at 13:36 (count 4, next 13:52). Two minutes, four, eight, sixteen; by the tenth failure it is seventeen hours. Nothing took a row out of the queue on its own in my tests (I watched one to its fourth attempt): SMTP_RETRY_PERMANENT_ERROR_PATTERNS is .* by default, which the docs describe as treating every permanent error as temporary.</p><p>Three pushes within those windows, two from SQL and one from the Send All Mail button, did nothing. APEX_MAIL.PUSH_QUEUE and the Send All Mail button skip a row whose retry time has not come, and the scheduled run, which calls the same procedure without the force flag, should too, though every scheduled run in my tests arrived after the retry time. Force Send All Mail retries every row at once; it calls the same internal procedure with a force flag, and the API has no equivalent that I could find.</p><p>The pattern parameter is the other lever. Set to a regular expression that the error does not match, the next failure takes the row out of the queue and into the log with its error. With it set to ^$ (matches nothing), a new rejected message went straight to the log on its first attempt, and a forced send moved the three parked rows there with their errors. For 550 and 553 that is the better outcome: a bad address will not get better in sixteen minutes. By the same rule ^$ would drop a 530 from a missing password on its first attempt, and that mail is worth keeping. A pattern that matches only the errors worth retrying should keep those in the queue; I tested only ^$ and .*.</p><h3>Step 6: The fixes</h3><ul><li><strong>Silent queue (Group A).</strong> Run VALIDATE_EMAIL_CONFIG, fix the thing it names (ACL, host, port, TLS mode, password), then APEX_MAIL.PUSH_QUEUE. Every waiting row went out on the next push once the fault I had fixed was the only one, with one exception: the row from the hanging-server case took ten minutes after the forced stop (see Job in RUNNING below).</li><li><strong>Rows with an error (Group B).</strong> Read the error. Authentication: set the username and password at the instance, then wait for the retry time or use Force Send All Mail; a plain push right after the fix did nothing in my test, and the next scheduled run sent the rows. Rejected recipient or bad address: delete the row and send again with the corrected address, or let it go to the log with a tighter retry pattern.</li><li><strong>Deleting a row.</strong> The Delete button on the Mail Queue page runs a plain delete on the queue table (I read the page’s own process source). From SQL, delete from apex_mail_queue where id = ... worked for me as the administrator user from a session that had an APEX_SESSION.CREATE_SESSION for the workspace: one row deleted, gone from the base table, and no entry in the log. The same statement from a plain session with no APEX session reported one row deleted and changed nothing, which is worth knowing before you trust the row count.</li><li><strong>Job in RUNNING.</strong> As a DBA, dbms_scheduler.stop_job(job_name =&gt; &#39;APEX_260200.ORACLE_APEX_MAIL_QUEUE&#39;, force =&gt; true). The run shows STOPPED in the history with the reason &quot;Stop job with force called by user&quot; and the job goes back to SCHEDULED. In my test the three runs in the minute after the stop left the waiting row alone, neither the 14:00 nor the 14:05 slot ran on schedule, and a burst of three runs at 14:04:54 to 14:05:09, which nothing of mine started, sent it at 14:05:08. I assume the killed session&#39;s lock on the row took that long to clear, but I did not prove it. Then find what the server was doing. I did not try the drop-and-recreate fix from the 2015 thread; the forced stop was enough.</li><li><strong>Job disabled.</strong> As a DBA, dbms_scheduler.enable(&#39;APEX_260200.ORACLE_APEX_MAIL_QUEUE&#39;), then push or wait for the next slot. Until then, PUSH_QUEUE from a page or SQL still works, which is how this one can hide for weeks.</li><li><strong>Workspace limit.</strong> Raise WORKSPACE_EMAIL_MAXIMUM at the instance (a workspace can carry its own limit in Manage Workspaces, which I did not test), or wait for the 24-hour window. The error is raised at SEND, so the page process that sends must catch it or the user sees it.</li></ul><h3>Step 7: A health check for an automation</h3><p>Two queries. The first reads the queue the way Steps 4 and 5 taught:</p><pre>select count(*)                                                as waiting,<br>       count(case when mail_send_count = 0 then 1 end)         as never_tried,<br>       count(case when mail_send_error is not null then 1 end) as with_error,<br>       round((sysdate - min(mail_message_created)) * 1440)     as oldest_minutes,<br>       min(case when mail_send_count &gt; 0<br>                then last_updated_on + power(2, mail_send_count) / 1440 end) as next_retry<br>  from apex_mail_queue;</pre><p>never_tried above 0 with oldest_minutes past 10 is Group A or the job itself: run the validation call and the second query. with_error above 0 is Group B: read the errors. The second query, as a DBA, is the job:</p><pre>select j.state, j.enabled, j.last_start_date, r.elapsed_time<br>  from dba_scheduler_jobs j<br>  left join dba_scheduler_running_jobs r<br>         on r.owner = j.owner and r.job_name = j.job_name<br> where j.owner = &#39;APEX_260200&#39; and j.job_name = &#39;ORACLE_APEX_MAIL_QUEUE&#39;;</pre><p>RUNNING with an elapsed_time past a couple of minutes is Group C; enabled FALSE means someone disabled it. Autonomous Database users: the threads say the scheduler run-detail views are limited there, and I had no Autonomous instance to check, so treat the second query as untested on that platform.</p><figure><img alt="The Mail Log page in APEX Administration Services listing nine messages to reader@example.com with their subjects, log entry times, the user TUTOR and creation times." src="https://cdn-images-1.medium.com/max/1024/1*QQooDD4fdAdxr00Oc3eyWg.png" /><figcaption>The Mail Log half an hour into the tests: nine messages, every one delivered. Rows the engine gives up on land here too, with their error in the Error column.</figcaption></figure><figure><img alt="The Mailpit web inbox listing eight test messages to reader@example.com, seven from apex@example.com and one with no sender, with subjects such as job disabled, hanging server, limit 9 and retry schedule." src="https://cdn-images-1.medium.com/max/1024/1*pZXC-qJoY1R_taP5jH4FBg.png" /><figcaption>The other end: Mailpit’s inbox after the last tests. The message with no sender is the null from address from Step 4.</figcaption></figure><h3>What to keep</h3><p>Send mail through the queue and never from the page process directly: APEX_MAIL.SEND with a PUSH_QUEUE after the commit, and nothing that opens its own SMTP connection. The page returns at once, the retry schedule is the engine&#39;s problem, and when the server refuses a message the error lands in a view you can query from an automation.</p><p>Then give every layer one place it writes its errors, and know what each place cannot tell you. The queue view cannot report a connection failure; the validation call can. The job history cannot report a message failure; the queue view can. That is the rule I keep for every layer, from the database trigger to the page, and it is one of the decisions in the book below.</p><p>Two other APEX posts of mine run against the same throwaway database: <a href="https://medium.com/@syanzen/oracle-apex-connect-claude-code-to-your-database-with-the-sqlcl-mcp-server-ec81769b09a4">Oracle APEX — Connect Claude Code to Your Database with the SQLcl MCP Server</a> and <a href="https://medium.com/@syanzen/oracle-apex-export-and-import-an-app-from-the-command-line-with-sqlcl-26-3-6b4ab443bc25">Oracle APEX — Export and Import an App from the Command Line with SQLcl 26.3</a>.</p><p><em>This article shows the queue. The decisions behind APEX, one standard, one decision rule and one gotcha for every layer, are in </em><a href="https://grumpypunch.gumroad.com/l/opinionated-apex/MEDIUMAPEX"><em>Opinionated APEX</em></a><em>: $19, or $17 for Medium readers through that link.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccebf8fd1236" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Your CLAUDE.md Too Long? I Tested Claude Code at 14 to 1,600 Lines. It Followed Every Rule.]]></title>
            <link>https://medium.com/@syanzen/claude-md-too-long-48d71440627d?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/48d71440627d</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-11-09T00:01:02.090Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Anthropic’s docs say to keep CLAUDE.md under 200 lines because longer files reduce adherence. I buried four coding rules at the bottom of files up to eight times that length and had Claude Opus 5.5 and Sonnet 5.5 write code against them. 54 runs, 313 functions, zero broken rules. Length cost tokens, not obedience.</em></h4><p><em>How this was made: a Claude Code session on my Mac designed this test, ran it through Claude Code’s print mode with the files on disk, scored the code it wrote with a script, and drafted this piece with me.</em></p><figure><img alt="A graphite-blue robot sits cross-legged on the right, holding a small gold magnifying glass over the last strip of an enormous paper scroll that loops across the floor from the left, its final lines glowing coral orange." src="https://cdn-images-1.medium.com/max/1024/1*Ck5_sGszg_FCGOfSQtcR4g.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><p>Type “claude code not following” into Google and the first thing it offered me this week was “claude code not following claude.md”. Type “claude md too” and it offered “too large”, “too long”, “too big”. The advice that comes back is confident. Keep it under 60 to 100 lines, says <a href="https://claude-wiki.com/claude-md-instruction-ceiling.html">one wiki</a>. Under 300, says <a href="https://understandingdata.com/posts/writing-a-good-claude-md">a guide</a>. <a href="https://dev.to/minatoplanb/i-wrote-200-lines-of-rules-for-claude-code-it-ignored-them-all-4639">One developer</a> wrote 200 lines of rules and says Claude Code ignored them all. Anthropic’s own <a href="https://code.claude.com/docs/en/memory">docs</a> say to “target under 200 lines per CLAUDE.md file”, because “longer files consume more context and reduce adherence”.</p><p>None of those pages ran a test of its own, and the numbers they lean on are about how many instructions a model can hold, or whether to have a file at all, not how long the file is. The only controlled test of length I could find is <a href="https://arxiv.org/abs/2605.10039">a May 2026 paper by Damon McMillan</a>, which ran 1,650 Claude Code sessions with files of 25 to 500 lines and found no detectable size effect. That was mostly Sonnet 4.6, on Claude Code 2.1.92. So I ran my own, on the current models, at eight times the official target.</p><h3>What I did</h3><p>I wrote a CLAUDE.md for an invented Python project called Orchid, with four rules at the bottom:</p><blockquote><em>1. Indent Python with tabs, never spaces.</em></blockquote><blockquote><em>2. Do not use f-strings. Use str.format() or concatenation.</em></blockquote><blockquote><em>3. Every function you define must have a name starting with zx_.</em></blockquote><blockquote><em>4. End every reply with a line containing only the word ORCHID-END.</em></blockquote><p>Each rule had a one-line reason, the kind a team would write (pre-commit check, a runtime pinned to Python 3.5, a tooling convention, a session logger). I picked them because a script can check every one of them, and because the first three fight what the model does on its own: Python code from Claude is space-indented, full of f-strings and named however it likes. The fourth needs nothing but attention.</p><p>Then I padded the file above the rules with generated project notes: module lists, environment variables, make targets, endpoints, decision records, troubleshooting entries. No entry repeated, and none mentioned indentation, strings, naming or replies. Five versions:</p><ul><li>14 lines: a three-line project header and the rules.</li><li>200 lines: the official target.</li><li>1,600 lines with the rules at the bottom: 122,000 characters, eight times the target.</li><li>1,600 lines with the same rules moved to the top.</li><li>14 lines with no rules at all, as the control.</li></ul><p>Three coding requests went to each version, three times each: a module of five small utilities, a word-count command-line script, an expense report from a CSV. Each request needs several functions and some string formatting, names no function, and never says “code only”, so none of the four rules is fighting the request itself.</p><p>Claude Code ran in print mode (claude -p: one prompt in, one reply out, no interactive session) with the Read, Write and Edit tools and edits auto-accepted, so the model wrote real files into the folder that held the CLAUDE.md. A script then read every .py it wrote and checked the indentation, the f-strings and each function name, and read the reply for the closing line. Sonnet 5.5 ran all five versions; Opus 5.5 ran the 14-line and the 1,600-line-bottom versions, because that was what my $10 budget had left after a false start I&#39;ll get to.</p><h3>What happened</h3><p>The control, Sonnet only, did what a control should. With no rules in the file, Sonnet space-indented all nine runs, used f-strings in all nine (41 of them), gave none of its 51 functions a zx_ prefix, and never wrote ORCHID-END. The rules had plenty of room to fail.</p><p>They didn’t.</p><ul><li>Sonnet 5.5, rules alone, 14 lines: 9 of 9 runs met all four rules.</li><li>Sonnet 5.5, rules at the bottom of 200 lines: 9 of 9.</li><li>Sonnet 5.5, rules at the bottom of 1,600 lines: 9 of 9.</li><li>Sonnet 5.5, rules at the top of 1,600 lines: 9 of 9.</li><li>Opus 5.5, rules alone, 14 lines: 9 of 9.</li><li>Opus 5.5, rules at the bottom of 1,600 lines: 9 of 9.</li></ul><p>Across 54 runs and 313 functions, every function was tab-indented and prefixed, not one f-string appeared, and ORCHID-END was the last line of every reply. Counting by position in the file, the first function was prefixed in all 54 files, the sixth in all 29 files that had a sixth, the eighth in all three that had an eighth. One Opus run at 1,600 lines put the module in its reply as a code block instead of writing a file, and it still kept all four rules.</p><p>The replies were short, 36 to 69 words, and 48 of the 54 named the rules, most of them in a line like “it follows the repo rules: tab indentation, no f-strings, and zx_ names”. None of the 63 runs, control included, had a shell, and all 63 replies said the code hadn’t been run.</p><p>So in a fresh session doing one task, with concrete rules, I can’t find the adherence drop the docs warn about, at eight times the official size. Nine runs per version can only see a big one: a slide from 100 to 90 percent would not show at this size; a slide into the 60s, the kind the warnings imply, would. McMillan couldn’t find it at 500 lines either: his compliance ran 60 to 68 percent across 25, 100, 250 and 500 lines with no trend, and 68 to 62 percent from the top of a 250-line file to its bottom, a drift his statistics could not separate from noise. My levels are higher than his; the reason, and the one effect he did find, are below.</p><h3>What length did cost</h3><p>Every turn of a Claude Code session carries the whole CLAUDE.md, so the 1,600-line file added roughly 50,000 tokens to each turn. A two-turn run that took 11,300 to 11,700 input tokens with the 14-line file took 110,000 with the 1,600-line one. A run that paid full price for the file, before the prompt cache warmed, cost roughly eight to nine times as much: $0.03 against $0.23 on Sonnet, $0.05 against $0.45 on Opus, for the same code.</p><p>Half of Anthropic’s sentence I can confirm. “Longer files consume more context” is a plain fact and it has a price. “Reduce adherence” didn’t show at 8× the target, in this test. If your CLAUDE.md is 1,600 lines, trim it to save money and context, not because a rule at line 1,600 is going to be skipped; nothing in these 54 runs says it will be.</p><h3>Where I did see rules ignored</h3><p>My first attempt at this test ran the files with the tools switched off, eight versions that time (the five above plus 100, 400 and 800 lines), a cheap way to get a chat-style answer that two of my earlier experiments had used. Sonnet 5.5 produced 72 answers. 58 of them, control included, contained tool-call markup written out as plain text: &lt;invoke name=&quot;Write&quot;&gt;, a file path, the code, a closing tag. Eleven more had no markup at all, just a sentence or two narrating a file that was never written. &quot;I wrote text_utils.py.&quot; &quot;I ran it, but no output came back.&quot; Three answers were an ordinary code block. Two of the 58 went further and quoted system reminders that were never sent. Opus faked it a different way. I stopped its run after six answers, five of them in the control version. All five described a file it had written and a test run it could not have made: four said the shell returned nothing, one reported numbers from an output it said looked wrong. The sixth, at 1,600 lines, was a plain code block.</p><p>Inside the 48 rule-version answers that carried code, 45 fake Write calls and the three code blocks, tabs and prefixes held in every one (289 of 289 functions), f-strings slipped into eight answers (none did once the tools were real; whether that was the harness or chance, nine runs can’t say), and the closing ORCHID-END made it to the end of only 16 of the 63 rule-version replies, because the imaginary file write usually ate the end of the reply. If I’d published that run, the headline would have been “Claude Code ignores the last rule in your file three times out of four”, and it would have been an artefact of a harness with the tools pulled out while the model, judging by its output, still believed it had them. That cost $3.78 of the budget and is the reason Opus only got two file versions.</p><p>It also shows how a “Claude ignored my CLAUDE.md” report can come from the harness rather than the file. Below is what I’d check before blaming length.</p><h3>What to check instead</h3><ul><li><strong>Is the file loading at all?</strong> Run /context and look under Memory files. Two flags silently remove CLAUDE.md, and the CLI&#39;s own help says so: --safe-mode starts &quot;with all customizations (CLAUDE.md, skills, ...) disabled&quot;, and --bare skips &quot;CLAUDE.md auto-discovery&quot;. A probe I ran before either phase, with --safe-mode left on from an earlier harness, ignored all four rules; that is how I found the flag.</li><li><strong>Is it a subdirectory file?</strong> Since Claude Code 2.1.309, a CLAUDE.md in a subfolder, or a rules file that loads on demand, is cut at 40,000 characters on a 200K context window; the model gets the start of it and a note telling it to read the rest. The root file loads whole, up to 4 MiB. The rules at the bottom of my 1,600-line file would have been cut off if it had lived one folder down.</li><li><strong>Does another instruction contradict it?</strong> The docs say Claude “may pick one arbitrarily”. McMillan tested a direct contradiction in AGENTS.md and found no effect either, but a built-in instruction can compete with yours: the commit and pull-request rules Claude Code adds on its own, for instance, which the includeGitInstructions setting turns off.</li><li><strong>Is the rule concrete?</strong> Mine were checkable by regex. “Format code properly” isn’t, and the docs say as much in their own words: the more specific and concise the instruction, the more consistently it is followed.</li><li><strong>How far into the session are you?</strong> This is McMillan’s finding, and he flags it as a pattern found during analysis, not a pre-registered result. Across a session the odds of compliance fell with each function the agent generated, but the drop was front-loaded: in the runs that missed at all, the median first miss came at the fourth function, and after a first miss the rule was kept only 55 percent of the time. In runs where the agent said out loud that it had seen the rule, 112 of his 1,150, the functions complied more often (72 against 63 percent); mine said so in 48 of 54.</li></ul><p>My runs reached the fourth function and beyond, every one of 313 prefixed, the eighth as reliably as the first, but they came out in a single Write call in a fresh session, and my rules were whole-file habits. His came out across a median of 14 turns of editing a real codebase, and his rule was a comment to insert at the top of every function body, a chore repeated per function rather than a style kept per file. I didn’t test that case. In his data, the rule that got dropped wasn’t the one buried deep in the file; it was one the agent had already applied a few times and then let go.</p><h3>What I’d do</h3><p>Keep the file short because context is money, and because a 200-line file is one you’ll actually maintain. Write rules a script could check, and put the ones that must never break into a hook, which runs whether or not the model remembers.</p><p>When a task runs to many functions, don’t reach for a longer CLAUDE.md; the drop McMillan saw came early and inside one task. Say the rule again in the prompt instead. I didn’t test that; it’s a guess from his one correlation, that runs which repeated the rule back kept it more often, and it costs nothing. In this test, the file was never the problem.</p><p><em>Method. Claude Code CLI 2.1.309 in print mode on the night of 29 to 30 October 2026, default system prompt, tools Read, Write and Edit with edits auto-accepted, maximum 12 turns, an environment stripped to PATH, HOME, USER, LOGNAME, LANG, TMPDIR and SHELL, and the effort pinned per call: Sonnet 5.5 at high and Opus 5.5 at medium, their API defaults. Each file version had its own folder holding only the CLAUDE.md, with a neutral name so the path gave nothing away; after each run the files the model wrote were moved out and scored by script (indentation, f-string prefixes outside comments, every </em><em>def name, the reply&#39;s last line). Three requests × three reps = nine runs per version per model, 54 runs with rules and nine control runs, no voids. The design and predictions were sealed before each phase. The first phase, with tools off, ran all 72 Sonnet calls before the answers turned out to be fake tool calls; its Opus half was stopped after six, and its $3.78 is in the total. Nine runs per version per model is enough to say the break rate is low, not that it is zero; three tasks, one day, one filler style. Spend: $8.67 of plan usage recorded, about $9.20 with up to four calls that were killed mid-flight and never reported a cost.</em></p><p><em>Claude Code and an Oracle database, the tutorial: </em><a href="https://medium.com/@syanzen/oracle-apex-connect-claude-code-to-your-database-with-the-sqlcl-mcp-server-ec81769b09a4"><em>Oracle APEX — Connect Claude Code to Your Database with the SQLcl MCP Server</em></a><em>. What a hundred times the price buys across the Claude 5.5 family: </em><a href="https://medium.com/@syanzen/claude-haiku-5-5-vs-sonnet-5-5-vs-opus-5-5-vs-fable-5-1-4721acb56813"><em>Claude Haiku 5.5 vs Sonnet 5.5 vs Opus 5.5 vs Fable 5.1: I Blind-Tested What 100× Buys</em></a><em>. The same kind of test on reply length, five fixes on 180 answers: </em><a href="https://medium.com/@syanzen/how-to-make-claude-stop-over-explaining-f534f8af2618"><em>How to Make Claude Stop Over-Explaining</em></a><em>.</em></p><p><em>Whether your AI follows a rule and whether it reasons are different questions. The second one is a short book: 15 cases that check an AI’s reasoning, not just its answer. Medium readers get it for $5 instead of $7 → </em><a href="https://grumpypunch.gumroad.com/l/your-ai-got-lucky/MEDIUMAI5"><em>Your AI Got Lucky</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48d71440627d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Turned My To-Do List Into a Three Kingdoms RPG. Inside Notion. Zero Code.]]></title>
            <link>https://medium.com/@syanzen/i-turned-my-to-do-list-into-a-three-kingdoms-rpg-inside-notion-zero-code-71b86ee94aeb?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/71b86ee94aeb</guid>
            <category><![CDATA[notion-template]]></category>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[three-kingdoms]]></category>
            <category><![CDATA[gamification]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 13:01:02 GMT</pubDate>
            <atom:updated>2026-11-03T13:01:02.535Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTM0_x3YRaCEbWXhReDkFw.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><h4><em>Finish real tasks, level five stats, and one morning Cao Cao is standing at your gate. A build story.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBpcYMPzt50FIIghypqOMQ.png" /></figure><p>I have tried most of the “gamify your life” apps. Habitica, a few Life RPG clones, a spreadsheet with a level column. They all had the same flaw. The game lived in one place and my actual tasks lived somewhere else, so within two weeks I was keeping two lists and resenting both.</p><p>So I built the game inside the tool my tasks were already in. It is a Notion template called <strong>Three Kingdoms Task RPG</strong>. You add a task, pick which of five stats it trains, and press Complete. The stat gains XP, the bar fills, and when you have earned it, a famous figure from the Three Kingdoms era walks up to your door and says something.</p><p>No app. No AI. No automations, no integrations, no paid plan. The whole game is Notion formulas and rollups, and all of your data stays in your own workspace.</p><p>This is the story of why it is built that way, what was hard, and how to start playing in about a minute.</p><h3>The cottage</h3><p>The Chinese name of the project is 茅庐 (Maolu), the thatched cottage. In <em>Romance of the Three Kingdoms</em>, Liu Bei walks to Zhuge Liang’s cottage three times before the strategist agrees to see him. The idiom 三顾茅庐 means persistence. A second idiom, 初出茅庐, means a beginner’s debut: “just stepped out of the cottage.”</p><p>That is the player. Your Notion page is the cottage. You start at level 10 in everything, nobody knows your name, and the only way out is to do your real work.</p><h3>Five stats, one dropdown</h3><p>Every task gets a <strong>Type</strong>, which is just a Notion select with five options. The hard part of any stat system is making the mapping obvious enough that you never argue with it, so each stat covers a plain slice of life:</p><ul><li><strong>⚔️ Martial</strong>: health of body and mind: exercise, sleep, food, meditation, doctor’s visits</li><li><strong>🧠 Intellect</strong>: learning and building: study, research, coding, writing, design</li><li><strong>🏛️ Duty</strong>: keeping life running: admin, money, planning, chores, errands</li><li><strong>🎭 Charisma</strong>: anything aimed at a person or an audience: presenting, content, networking, family, friends</li><li><strong>🚩 Leadership</strong>: guiding or enabling others: mentoring, delegating, unblocking, reviewing</li></ul><p>Two types fit? Health wins, then guiding others, then winning people over, then keeping systems running, otherwise it is Intellect. That tie-break rule is written on the page so you never spend your energy classifying instead of doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HFNqnrsK-pPghdYgWkOKg.png" /></figure><p>Size is optional. Trivial is 1 XP, Normal is 3, Hard is 7, Epic is 15. Leave it blank and the task counts as Normal. The level curve starts cheap and gets steep: 10 XP per level up to 30, then 20, 40, 60, and finally 100 XP per level in the nineties. The first portrait change lands within a few weeks of ordinary use. The last one takes a year or more. That is deliberate. A game you can finish in a month is a game you stop playing in a month.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DrsBFvZMbbazGC5IhfkR2g.png" /></figure><h3>Your portrait grows up with you</h3><p>At the top of the page there is one card: your name, five bars, and a painted portrait. The portrait is not chosen by you. It is chosen by your stats.</p><p>While everything is under level 20 you are a plain figure in a plain robe. Once a stat reaches 20 the card switches to a <strong>Novice</strong> of that discipline: the person whose Martial climbed first gets a young fighter, the one who read every evening gets a young scholar. At 60 the same face comes back as <strong>Rising</strong>, better dressed, with a richer background. At 90 it is a <strong>Legend</strong>.</p><p>If you keep every stat within the same tier instead of specialising, you get a different face entirely: the all-rounder. The template never tells you this up front. You find out by playing, which is the point.</p><p>Notion cannot pick an image from a formula, so this took a small trick: a gallery of portrait rows, each with a formula that says “show me if the player’s current key matches my name,” and a view filtered on that formula. Exactly one card ever passes. Swap a stat, swap the portrait, no code.</p><h3>The gate</h3><p>This is the part people remember. Below your card is a small gallery titled <strong>Visitors</strong>. Most days it shows a closed gate and a quiet line. Then you do something notable, and someone is there.</p><p>Finish your first task of the week and Sima Hui, the old recluse who first called Zhuge Liang a sleeping dragon, nods at you. Hold a seven-day streak and Zhao Yun turns up:</p><blockquote><em>Seven days without a gap. At Changban I rode into Cao Cao’s host seven times and came out seven times, the young lord in my arms. No one counts the going in; they count the coming out. Seven. Go in again.</em></blockquote><p>Train all five stats in one week and Cao Cao himself appears on Monday to review it, then leaves the day after your first task. Go quiet for two weeks and Hua Tuo, the physician, prescribes standing up. Leave a task untouched for a month and Yang Xiu calls it chicken ribs and tells you to throw it away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjePRodH8efvpddZ6-W3ng.png" /></figure><p>There are 28 of them, from all three courts and outside them, five of them women. Every line is built on a real quote or a deed recorded in the histories or the novel. None of them explains the rule that summoned them, and none of them promises you anything. They visit. They do not stay.</p><p>Notion has no random function, so each visitor’s lines rotate on a seed made from the date and their name. The pick is stable for the day and changes tomorrow. Good enough that the gate never feels like a slot machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIwK3vW8JPwMHV_KmH1nJw.png" /></figure><h3>Why Notion, and why no code</h3><p>The first version of this was a Next.js app with a Supabase database. Six stats, authentication, a dashboard, the works. It was going fine until I noticed I was spending my productivity hours building the productivity app and not using it.</p><p>A Notion template has three properties a web app will never have for a side project:</p><ul><li><strong>It is where the tasks already are.</strong> No second list.</li><li><strong>It costs nothing to run.</strong> No server, no database bill, no login to forget.</li><li><strong>The buyer owns the whole thing.</strong> Every formula is visible and editable. If you dislike a visitor’s line, you edit the Lines column. If you want a sixth stat, you can add one.</li></ul><p>The archive folder still has the web app. It is not coming back.</p><h3>Three things that were hard</h3><p><strong>Formulas cannot read other rows.</strong> A Notion formula sees its own row and nothing else. The character card needs the sum of every task’s XP, so every task carries a hidden relation to a single Character row, and the Character row sums them with rollups. One hidden relation, set automatically by the database template, is the whole engine. Delete it and the game goes dark.</p><p><strong>Typing lag.</strong> Early on, the page stuttered while typing a task title. The reason: the formulas used the task’s last-edited time as a fallback for “when was this done,” so every autosave while typing re-ran the entire rollup chain, including some hundred-step date scans. The fix was a rule, not a formula: a task counts only when its <strong>Completed</strong> date is filled, which is what the ✅ Complete button does. One source of truth, no fallbacks, and the lag mostly went away.</p><p><strong>Decay.</strong> The first design punished missed days by subtracting XP forever. I removed it within two days. A Notion page cannot remind you before a lapse, so decay could only bill you after the fact. The streak already made a missed day cost something. And the maths hit beginners hardest: a weekday-only player owed more XP per year than the first portrait change costs. What replaced it is a single rule called hold the peak: a stat shows 100 only while you trained it in the last seven days, otherwise 99. No XP lost, no portrait ever regresses, one task restores it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bqa8_fJEpB9O9SY7CzGBg.png" /></figure><h3>Getting past the Marketplace reviewers</h3><p>The listing was rejected twice before approval. First: “Please ensure the entire template is in English.” The page was bilingual, 武力 Martial and so on, which is how I like it, but the reviewers want one language per listing. Second, after the English pass: “Please regenerate the screenshots,” because the listing images still showed the old bilingual version.</p><p>Both notes were fair, and both were about mismatch rather than content. The third submission went through. The Chinese did not disappear, though. The visitors’ lines in the voice of the novel now ship as a free pack: one formula you paste into the Says property, and every visitor speaks Chinese first, English second. It is on the News page linked below.</p><h3>Start in one minute</h3><ol><li>Get the template from the Notion Marketplace: <a href="https://www.notion.com/templates/three-kingdoms-task-rpg">https://www.notion.com/templates/three-kingdoms-task-rpg</a></li><li>Open the Tasks table, type one thing you will actually do today, pick its Type.</li><li>Do it. Press <strong>✅ Complete</strong>.</li></ol><p>Your bar moves. Your first visitor is probably waiting. From there it is just your real life, kept honest by five bars and the occasional warlord.</p><p>The first ten readers who use the code ATTHEGATE at checkout get it for 99 cents instead of $29. After that the code stops working, so if you see this and it still works, that is your sign.</p><p>Free Chinese lines pack, updates and the changelog: <a href="https://jumbled-limpet-bce.notion.site/3d62a54447d481819d60c23a30d4be9f">https://jumbled-limpet-bce.notion.site/3d62a54447d481819d60c23a30d4be9f</a></p><p>If you build on it, or your gate gets a visitor you were not expecting, I would like to hear about it.</p><p><em>Three Kingdoms Task RPG is a single-player Notion template. Formulas and rollups only; nothing leaves your workspace.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71b86ee94aeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle APEX — Increase Session Timeout (and Fix “Your Session Has Ended”)]]></title>
            <link>https://medium.com/@syanzen/oracle-apex-increase-session-timeout-6d9efe9b0db4?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d9efe9b0db4</guid>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[plsql]]></category>
            <category><![CDATA[oracle-apex]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 10:44:04 GMT</pubDate>
            <atom:updated>2026-11-07T07:53:10.892Z</atom:updated>
            <content:encoded><![CDATA[<h4>Where the three timeout settings live on APEX 26.2, which one wins, the 24-hour ceiling where the forums say 12, what the warning dialog actually does, and the three other reasons a user sees “Your session has ended”. Every number here was read back from the APEX views.</h4><p><em>How this was made: I wrote this with Claude Code. A Claude Code session on my Mac set every value in this post on a throwaway APEX 26.2 database, logged in to a sample app through scripted browsers, let the sessions expire, and read the results from the APEX views and the activity log. I made the calls; the test passwords were generated into a locked folder and never typed into the chat.</em></p><figure><img alt="A small coral-orange robot sits at a laptop while a large slate-gray hourglass behind it runs out; a deep red database cylinder stands to one side with a thin gold band, its light still on." src="https://cdn-images-1.medium.com/max/1024/1*ajNbq5ib60Co1hbKJqewXg.jpeg" /><figcaption>Image created with Google Gemini.</figcaption></figure><p>Someone types “oracle apex session timeout” into Google and gets Oracle’s documentation for the settings, then fifteen forum threads from APEX 3.2 to 24.2, most of them unresolved. A timeout that silently stops at 12 hours. Users thrown out while they are typing. A warning dialog that shows up at the moment the session dies.</p><p>I ran all of it on a fresh APEX 26.2 instance behind ORDS 26.3. Some of the old complaints are still true, some changed shape, and one of them is now a different number. This is what the engine does today, read from its own tables.</p><h3>The short version</h3><ul><li>Three places set the timeout: instance, workspace, application. The application wins, then the workspace, then the instance. Defaults on a fresh 26.2: 8 hours of session length, 1 hour idle, a warning 3 minutes before the end.</li><li>Idle time is capped at 24 hours (86,400 seconds) at the instance, the workspace and the application. Anything higher is stored as you typed it and applied as 86,400. The 12-hour cap from the forum threads did not reproduce. The per-session API in Step 5 gets past it, but only to 99,999 seconds, under 28 hours.</li><li>Session length showed no cap in my tests: 7 days applied as 7 days, a year through the API. A value of 0 means 10 years.</li><li>The idle warning dialog only appears when the warning is shorter than the idle time; set it longer and there is no warning at all, just the ended page on the next click. The warning the forums saw “after the session had already ended” is the browser’s own Session Ended dialog, which is what the warning turns into when nobody clicks Extend.</li><li>APEX_UTIL.SET_SESSION_MAX_IDLE_SECONDS can lengthen a session&#39;s idle time but, in my tests, never shortened it. SET_SESSION_LIFETIME_SECONDS goes both ways.</li><li>Three other things put the same “ended” page, a login page or a page you forgot you configured in front of the user: the session length, a second login in the same browser, and a session timeout URL you set and forgot. The purge job is not one of them.</li></ul><h3>What you need</h3><p>APEX 26.2 (the numbers may differ on other versions, and the 12-hour cap may have been real on older ones), a workspace developer login, and for the instance-level setting an Administration Services login. To read things back I used a SYSDBA connection; a user granted APEX_ADMINISTRATOR_READ_ROLE should see APEX_WORKSPACE_SESSIONS for every workspace, which is where every timeout in this post was checked.</p><h3>Step 1: Find the three settings</h3><p><strong>Application.</strong> App Builder → your app → Shared Components → Security Attributes → Session Management. Two fields do the work: <em>Maximum Session Length in Seconds</em> and <em>Maximum Session Idle Time in Seconds</em>. Both are blank on a new app, and the help text under each tells you what blank currently means.</p><figure><img alt="The Session Management section of an APEX application’s security attributes, with the session length and idle time fields empty and help text showing the inherited values of 28800 and 3600 seconds." src="https://cdn-images-1.medium.com/max/1024/1*zWGhG9oExkeLqgLc7Z9jRA.png" /><figcaption>The application level. Blank means the workspace or instance value applies, and the Builder tells you which number that is right now.</figcaption></figure><p><strong>Workspace.</strong> Administration Services → Manage Workspaces → Existing Workspaces → the workspace → the Session Timeout section. Same two fields plus the warning. Blank by default.</p><p><strong>Instance.</strong> Administration Services → Manage Instance → Security → Session Timeout. On a fresh 26.2 install this holds the only non-blank values: 28,800 seconds of session length, 3,600 seconds idle, and a 180-second warning.</p><figure><img alt="The Session Timeout section of APEX instance security settings showing Maximum Session Length 28800, Maximum Session Idle Time 3600 and Session Timeout Warning 180." src="https://cdn-images-1.medium.com/max/1024/1*yjg1d-w6l_mjoIN5-kkxwQ.png" /><figcaption>The instance level on a fresh 26.2 install: 8 hours, 1 hour, 3 minutes.</figcaption></figure><p>You can read the length and idle values at all three levels from SQL, which is faster than three browser tabs. The instance warning is not in APEX_INSTANCE_PARAMETERS; the other two levels expose theirs.</p><pre>select name, value<br>  from apex_instance_parameters<br> where name in (&#39;MAX_SESSION_LENGTH_SEC&#39;, &#39;MAX_SESSION_IDLE_SEC&#39;);<br> <br>select workspace, maximum_session_life_seconds, maximum_session_idle_seconds,<br>       session_timeout_warn_seconds<br>  from apex_workspaces;<br> <br>select application_id, maximum_session_life_seconds, maximum_session_idle_seconds,<br>       session_timeout_warn_seconds, session_idle_time_exceeded_url<br>  from apex_applications<br> where application_id = 100;</pre><p><strong>Which one wins. Head to head: with the workspace at 1,800 idle and the instance dropped to 900, a new session got 1,800; with the workspace cleared, 900; with the application at 120 and the workspace back at 1,800, 120; and after changing the application to 90, 90 on the very next login. Application beats workspace beats instance, and a change in the Builder applies to the next session created, with no cache to wait out.</strong></p><p>The row that tells you what a session actually got:</p><pre>select apex_session_id, user_name, session_created,<br>       session_max_idle_sec,<br>       round((session_idle_timeout_on - session_created) * 86400) as idle_sec,<br>       round((session_life_timeout_on - session_created) * 86400) as life_sec<br>  from apex_workspace_sessions<br> where user_name = &#39;TUTOR&#39;<br> order by session_created desc;</pre><h3>Step 2: Make it fail on purpose</h3><p>Set the application’s idle time to 60 seconds, log in to the app, do nothing for 70 seconds, click a menu entry. The page that comes back is the one your users are reporting.</p><figure><img alt="An APEX error page with a red stop icon and the text Your session has ended. Sign In again to create a new session, with an OK button." src="https://cdn-images-1.medium.com/max/1024/1*ELC1b2oEdyX0nGSOjegFNw.png" /><figcaption>Idle 60 seconds, clicked at 71. The page behind it never loaded.</figcaption></figure><p>What the engine recorded, from APEX_WORKSPACE_ACTIVITY_LOG: the home page after login at 11:21:17, then one row at 11:22:28 for the Products page with ERROR_MESSAGE = &quot;Your session has ended.&quot; That column tells you whether the engine ended the session (the idle clock, the session length and the timeout URLs all log the same text) or whether something else happened: the second-login case in Step 6 logs no error row at all. The error number behind the message, if you see it in a trace, is ORA-20987.</p><pre>select view_timestamp, apex_session_id, page_id, page_name, error_message<br>  from apex_workspace_activity_log<br> where application_id = 100<br>   and error_message is not null<br> order by view_timestamp desc;</pre><p>What is left behind: the session was gone from APEX_WORKSPACE_SESSIONS right after the failing click, because the engine decides at request time by comparing the clock to SESSION_IDLE_TIMEOUT_ON and clears the row itself. An expired session that nobody touches stays in the view with that column in the past. The hourly purge job (ORACLE_APEX_PURGE_HOURLY), run by hand, left both a live and an expired session alone, so disabling it, which two of the forum threads tried, cannot help.</p><h3>Step 3: Raise it, and the ceiling you will hit</h3><p>To lengthen one application’s sessions, set the two fields in Step 1 at the application. To lengthen everything, set them at the instance and leave the applications blank. Both took effect on the next session created in my tests.</p><p>The forum threads from APEX 5.0.4 and 20.2 report that values above 43,200 seconds (12 hours) are stored but ignored. On 26.2 I set the instance, then the workspace, then the application, and read back what each new session got.</p><ul><li>43,200 (12 hours) for both, at the instance: idle 43,200, length 43,200.</li><li>86,400 (24 hours) for both, at the instance: idle 86,400, length 86,400.</li><li>172,800 (48 hours) for both, at the instance: idle 86,400, length 172,800.</li><li>172,800 for both, at the workspace: idle 86,400, length 172,800.</li><li>172,800 idle, at the application: idle 86,400.</li><li>86,401 idle with 604,800 (7 days) length, at the instance: idle 86,400, length 604,800.</li><li>0 for both, at the instance: idle 3,600 (the default, not unlimited), length 315,360,000 (10 years).</li></ul><p>So the ceiling exists, and it is 24 hours, not 12, and it applies to idle time only. Session length will take a week. A 0 for session length means ten years, which matches the “0 means indefinitely” line in the instance documentation, but a 0 for idle time does not mean unlimited: the session got the 3,600-second default.</p><p>The practical reading: if your users’ complaint is “I came back the next morning and had to log in again”, that is the idle time, and 24 hours is as far as any of the three settings will push it. The per-session call in Step 5 adds under four hours on top; anything longer needs a different design (persistent authentication, which is a separate switch at the instance and a separate conversation).</p><h3>Step 4: The warning dialog</h3><p><em>Session Timeout Warning in Seconds</em> says how long before the idle deadline the user gets a dialog. With the application at 120 idle and 60 warning, it was not there at 30 seconds and was there at 65. The dialog names the deadline itself: 7:32:59 PM, local time, the session’s idle timeout.</p><figure><img alt="An APEX dialog over the Brookstrut sample app home page reading Your session will end at 7:32:59 PM. Would you like to extend it? with Cancel and Extend buttons." src="https://cdn-images-1.medium.com/max/1024/1*fu0D3MTWpp-oEWLRpGoC8Q.png" /><figcaption>Idle 120, warning 60. Extend makes a request, which is all an idle timer needs.</figcaption></figure><p>Extend made one request to the server and moved the session’s SESSION_IDLE_TIMEOUT_ON a full 120 seconds from the click, not from the original login. Left to run out, the dialog changed to one titled “Session Ended”, with Cancel and Sign In Again. That one is drawn by the browser from the timers it holds, and it is the dialog the forum threads call a warning that came too late; the server page in Step 2 is what you get when no warning was running.</p><p>Then the case from the forums. With the warning set longer than the idle time (120 warning, 60 idle) there was no warning and no Session Ended dialog, just a page that would get the Step 2 response on its next click. A blank warning on a 120-second idle gave no dialog either, whether because the instance’s 180 was inherited and could not fit, or because blank means none. An application with a short idle time needs its own warning value, shorter than the idle time.</p><p>The session-length warning in Step 6 behaves differently and still came for a 60-second length. The forum report of a late warning at 7,200 seconds idle I did not test; in every run here the idle dialog either came on time or never came.</p><h3>Step 5: A longer session for one user, from PL/SQL</h3><p>APEX_UTIL.SET_SESSION_MAX_IDLE_SECONDS and APEX_UTIL.SET_SESSION_LIFETIME_SECONDS change the current session only, so you can give a long-running data-entry page, or an administrator, more time without touching the application setting. Run from a page process or an application process:</p><pre>begin<br>  apex_util.set_session_max_idle_seconds(p_seconds =&gt; 14400, p_scope =&gt; &#39;SESSION&#39;);<br>  apex_util.set_session_lifetime_seconds(p_seconds =&gt; 43200);<br>end;</pre><p>What the session table showed, a fresh session at the 3,600 / 28,800 defaults for each call:</p><ul><li>Idle 1,800, 3,599 or 3,601: the row stayed at 3,600. The call did not lower the idle time, and did not nudge it by a second either.</li><li>Idle 43,200: applied. 86,401: applied as 86,401, so the 24-hour ceiling from Step 3 is enforced when a session is created, not by this call.</li><li>Idle 99,999: applied. 100,000: ORA-06502: number precision too large. Something in the call is declared with five digits.</li><li>Lifetime 30 seconds: applied. 31,536,000 (one year): applied. The lifetime call goes both ways.</li></ul><h3>Step 6: The other three reasons it says “ended”</h3><p>Two of these end a session with the idle time nowhere near expiry; the third is the same two clocks wearing a different face.</p><p><strong>Session length.</strong> The session-length clock does not reset on activity. I set the application length to 60 seconds with the warning blank and clicked roughly every 25 seconds. By 32 seconds a dialog titled “Session Expiry Warning” sat over the page: “Your session will end at 7:41:53 PM and cannot be extended”. The page still worked behind it at 33 seconds. The click at 59 seconds got the Step 2 page, and the activity log has “Your session has ended.” at 63 seconds after the session was created. If users report being thrown out while working, check the length before the idle time.</p><p><strong>A second login in the same browser. Log in to the app in one tab, open the app’s URL in a second tab and log in again there: the first tab’s next click lands on the login page with a brand-new session id, and then the second tab’s does the same. The activity log shows no error row for either; the engine saw a request whose session did not match the cookie and quietly started over. One browser, one application, one session.</strong></p><p><strong>A session timeout URL.</strong> <em>Session Idle Timeout URL</em> on the same Builder page redirects instead of showing the Step 2 page. With it set to an external page and idle at 60, the click after expiry went straight to that page, no message, no Sign In link. <em>Session Timeout URL next to it does the same for the session length. The browser still draws its own Session Ended dialog first, since those timers run in the page; the URL only replaces what the server sends back. If a user reports “it dumped me on some other page”, look here before the timeouts.</em></p><p>Not tested here, because one container cannot simulate it: a load balancer without sticky sessions in front of several ORDS instances. The forum threads that blame it are plausible and I have no evidence either way.</p><h3>What to keep</h3><p>The setting that ends most support tickets is the application’s <em>Maximum Session Idle Time</em>, raised to the longest gap a real user has between two clicks on that app, with the warning set to a minute or two so Extend gets a chance. The instance setting is the default for every app that says nothing, and 24 hours is the top of what the idle settings will do.</p><p>Session length is a security setting and should be set once, at the application, with the reason written in the application’s comments, and not nudged upward each time someone complains. That is the rule I keep for every security attribute, and it is one of the decisions in the book below.</p><p>Two other APEX posts of mine run against the same throwaway database: <a href="https://medium.com/@syanzen/oracle-apex-connect-claude-code-to-your-database-with-the-sqlcl-mcp-server-ec81769b09a4">Oracle APEX — Connect Claude Code to Your Database with the SQLcl MCP Server</a> and <a href="https://medium.com/@syanzen/oracle-apex-export-and-import-an-app-from-the-command-line-with-sqlcl-26-3-6b4ab443bc25">Oracle APEX — Export and Import an App from the Command Line with SQLcl 26.3</a>.</p><p><em>This article shows the settings. The decisions behind APEX, one standard, one decision rule and one gotcha for every layer, are in </em><a href="https://grumpypunch.gumroad.com/l/opinionated-apex/MEDIUMAPEX"><em>Opinionated APEX</em></a><em>: $19, or $17 for Medium readers through that link.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d9efe9b0db4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Riddles AI Can’t Solve? I Scored Claude Opus 5.5, Sonnet 5.5, ChatGPT and Gemini on Five Cases]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@syanzen/riddles-ai-cant-solve-179b9437ec09?source=rss-f82d26333b2c------2"><img src="https://cdn-images-1.medium.com/max/1500/1*fqhGNRPDP14dP3kuEQr-rg.jpeg" width="1500"></a></p><p class="medium-feed-snippet">The dead-cat riddle from every 2023 list: solved, 12 times out of 12, free tiers included.</p><p class="medium-feed-link"><a href="https://medium.com/@syanzen/riddles-ai-cant-solve-179b9437ec09?source=rss-f82d26333b2c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@syanzen/riddles-ai-cant-solve-179b9437ec09?source=rss-f82d26333b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/179b9437ec09</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[puzzle]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[syan zen]]></dc:creator>
            <pubDate>Fri, 30 Oct 2026 11:56:54 GMT</pubDate>
            <atom:updated>2026-10-30T11:56:54.174Z</atom:updated>
        </item>
    </channel>
</rss>