Hi Eric, * Overview
In order to be able to create a big code from small chunks, I need to compose with the *expanded* view of a block, instead of its *evaluated* result. I don't see how to do that while keeping the small block *executable*. * Use case A use case could explain the need in a much clearer manner. I have a SQL block that duplicates a row: #+srcname: insert-duplicate-row-with-ID #+begin_src sql :var table="order" :var column="ID" :var source_value="'73-0007'" :var target_value="'73-0008'" INSERT INTO $table ... #+end_src This block is executable, that is I can call it on the fly to make what I mean. This is good. Now, I wanna make use of that general "function" in a long stored procedure, customized to duplicate a row in a large set of tables. Something like this: #+begin_src sql :noweb yes CREATE PROCEDURE clone_row_with_ID @source_value varchar(16), @target_value varchar(16) AS <<insert-duplicate-row-with-ID("table1", "column", "@source_value", "@target_value")>> <<insert-duplicate-row-with-ID("table2", "column", "@source_value", "@target_value")>> ... <<insert-duplicate-row-with-ID("tableN", "column", "@source_value", "@target_value")>> GO #+end_src But this does not work, as Babel replaces the Noweb call with the results of its evaluation, not with the results of its *expansion*. Is there a way to get it working? * Workaround A very ugly workaround which I see is that: - the reference block prints out SQL code: for example, an AWK code printing SQL statement. - the general block calls Noweb, and receives the output of AWK's execution, hence expanded SQL code. But, then, the reference block is not executable anymore. Not really a workaround, then... Best regards, Seb -- Sebastien Vauban