Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

If/then formatting in sql developer

291771Oct 2 2017 — edited Oct 18 2017

The SQL Deveoper version 17.2 puts line breaks afre IF and THEN keywords whatever options i choose in formatting options. I would like to have IF condtion THEN in one line, how can I change that ?

-- create_package_body.htm#LNPLS01381 

CREATE OR REPLACE PACKAGE BODY emp_mgmt AS

    tot_emps    NUMBER;

    tot_depts   NUMBER;

    FUNCTION hire (

        last_name       IN VARCHAR2,

        job_id          IN VARCHAR2,

        manager_id      NUMBER,

        salary          NUMBER,

        department_id   NUMBER

    ) RETURN NUMBER IS

        new_empno   NUMBER;

    BEGIN

        IF

            last_name IS NULL

        THEN

            NULL;

        END IF;

    END;

END emp_mgmt;

/

-

Comments

odie_63
Answer

You'll have to do it in two steps in order to avoid namespace redeclarations at child level :

SQL> SELECT xmlserialize(document

  2           insertchildxml(

  3             appendChildXML(

  4               xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"><B/></A>')

  5             , '/A'

  6             , xmlelement("C", xmlattributes('attribute' as "attr"))

  7             , 'xmlns="namespace"'

  8             )

  9           , '/A/C'

10           , '@def:attribute'

11           , 'def_attribute'

12           , 'xmlns="namespace" xmlns:def="myns_namespace"'

13           )

14           indent

15         )

16  FROM dual;

XMLSERIALIZE(DOCUMENTINSERTCHI

--------------------------------------------------------------------------------

<A xmlns="namespace" xmlns:def="myns_namespace">

  <B/>

  <C attr="attribute" def:attribute="def_attribute"/>

</A>

Marked as Answer by Geraud · Sep 27 2020
Geraud

Weird, I really thought I had tried this approach and it didn't work. I must not have commented out another line that I should have. This works, thank you.

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 15 2017
Added on Oct 2 2017
2 comments
542 views