Originally posted by Barabas
I could'nt get it working using the select in the decode statement.
There are limitations on where you can put a select statement - these limitations are version dependant and in some versions they are different between SQL & PL/SQL. You need to RT*M(s) to find out exactly what you can and can't do.

If you insist on it being a single SQL statement, you will need to recode it something like:
INSERT INTO sales_ledger(. . . .)
(SELECT va1, val2, . . . , decode(...) . . . FROM so_headers_all WHERE . . .)

But I still think it will be more readable if you separate the select & decode from the insert.