Uzun bir PL / pgSQL kod satırını birden çok satıra nasıl bölerim?


16

Uzun bir PL / pgSQL kodu satırını birden çok satıra bölmenin bir yolu var mı? Bağlamım, aşağıdaki gibi bir tabloya ekler günlüğü tetikleyen bir işlevdir:

INSERT INTO insert_log (log_time, description)
VALUES (
    now()
    , 'A description. Made up of 3 semi long sentences. That I want to split, in the code, not in the log table, over 3 lines for readability.'
);

2
Bu düz bir SQL, PL / pgSQL değil
a_horse_with_no_name

Ben sadece yardıma ihtiyacım olan yığın dahil, bu bir PL / pgSQL fonksiyonunun bir parçası.
dw8547

Yanıtlar:


23

Dize sabitleri kılavuzda belirtildiği gibi birden çok satıra bölünebilir

INSERT INTO insert_log (log_time, description)
VALUES (
    now()
    , 'A description. Made up of 3 semi long sentences. '
      'That I want to split, in the code, not in the log table, '
      'over 3 lines for readability.'
);
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.