Character order of NLS_SORT WEST_EUROPEAN












0














I have a template on a table T1



T1



ID | Name
---|----------
1 | template1


Then I have some parameters that needs to be filled when someone use the template on a table T2



T2



ID | Template_ID | Params
---|-------------|---------
1 | 1 | @param1
2 | 1 | @param2
3 | 1 | @param3
4 | 1 | @param4


Table T3 link the template and the params with the specific values (if the user doesn't set a param, the table it will be filled with the default name, so the user can set it later)



T3



ID | Param_ID | Value
---|----------|---------
1 | 1 | xyz
2 | 2 | @param2
3 | 3 | 1
4 | 4 | @param4


So, i need to list the templates that have, at least, 1 param without a specific value, in only 1 line, but with this query:



select T1.Name, T3.Value
from T1 inner join T2
on T1.ID = T2.Template_ID
inner join T3
on T2.ID = T3.Param_ID
where T3.Value like '@%';


I got 2 lines as a result. The problem is, I have a system over oracle DB and I can't do my own queries or change the DB parameters, only select the columns of the tables (or use only this 4 functions max, min, sum and count over the columns) and the system do all the query by itself, so, I can't use big tricks on 'where' or 'order by' clause (force NLS_SORT as Binary, or use ROWNUM = 1, for example). So, my only idea is use another character instead of @ to identify the default params, to use MAX or MIN function over the T3.Value, but the character needs to be, for sure, the first or the last one in the WEST_EUROPEAN sort and I can't find anywhere which is the sort order of this. Can anyone help me?










share|improve this question





























    0














    I have a template on a table T1



    T1



    ID | Name
    ---|----------
    1 | template1


    Then I have some parameters that needs to be filled when someone use the template on a table T2



    T2



    ID | Template_ID | Params
    ---|-------------|---------
    1 | 1 | @param1
    2 | 1 | @param2
    3 | 1 | @param3
    4 | 1 | @param4


    Table T3 link the template and the params with the specific values (if the user doesn't set a param, the table it will be filled with the default name, so the user can set it later)



    T3



    ID | Param_ID | Value
    ---|----------|---------
    1 | 1 | xyz
    2 | 2 | @param2
    3 | 3 | 1
    4 | 4 | @param4


    So, i need to list the templates that have, at least, 1 param without a specific value, in only 1 line, but with this query:



    select T1.Name, T3.Value
    from T1 inner join T2
    on T1.ID = T2.Template_ID
    inner join T3
    on T2.ID = T3.Param_ID
    where T3.Value like '@%';


    I got 2 lines as a result. The problem is, I have a system over oracle DB and I can't do my own queries or change the DB parameters, only select the columns of the tables (or use only this 4 functions max, min, sum and count over the columns) and the system do all the query by itself, so, I can't use big tricks on 'where' or 'order by' clause (force NLS_SORT as Binary, or use ROWNUM = 1, for example). So, my only idea is use another character instead of @ to identify the default params, to use MAX or MIN function over the T3.Value, but the character needs to be, for sure, the first or the last one in the WEST_EUROPEAN sort and I can't find anywhere which is the sort order of this. Can anyone help me?










    share|improve this question



























      0












      0








      0







      I have a template on a table T1



      T1



      ID | Name
      ---|----------
      1 | template1


      Then I have some parameters that needs to be filled when someone use the template on a table T2



      T2



      ID | Template_ID | Params
      ---|-------------|---------
      1 | 1 | @param1
      2 | 1 | @param2
      3 | 1 | @param3
      4 | 1 | @param4


      Table T3 link the template and the params with the specific values (if the user doesn't set a param, the table it will be filled with the default name, so the user can set it later)



      T3



      ID | Param_ID | Value
      ---|----------|---------
      1 | 1 | xyz
      2 | 2 | @param2
      3 | 3 | 1
      4 | 4 | @param4


      So, i need to list the templates that have, at least, 1 param without a specific value, in only 1 line, but with this query:



      select T1.Name, T3.Value
      from T1 inner join T2
      on T1.ID = T2.Template_ID
      inner join T3
      on T2.ID = T3.Param_ID
      where T3.Value like '@%';


      I got 2 lines as a result. The problem is, I have a system over oracle DB and I can't do my own queries or change the DB parameters, only select the columns of the tables (or use only this 4 functions max, min, sum and count over the columns) and the system do all the query by itself, so, I can't use big tricks on 'where' or 'order by' clause (force NLS_SORT as Binary, or use ROWNUM = 1, for example). So, my only idea is use another character instead of @ to identify the default params, to use MAX or MIN function over the T3.Value, but the character needs to be, for sure, the first or the last one in the WEST_EUROPEAN sort and I can't find anywhere which is the sort order of this. Can anyone help me?










      share|improve this question















      I have a template on a table T1



      T1



      ID | Name
      ---|----------
      1 | template1


      Then I have some parameters that needs to be filled when someone use the template on a table T2



      T2



      ID | Template_ID | Params
      ---|-------------|---------
      1 | 1 | @param1
      2 | 1 | @param2
      3 | 1 | @param3
      4 | 1 | @param4


      Table T3 link the template and the params with the specific values (if the user doesn't set a param, the table it will be filled with the default name, so the user can set it later)



      T3



      ID | Param_ID | Value
      ---|----------|---------
      1 | 1 | xyz
      2 | 2 | @param2
      3 | 3 | 1
      4 | 4 | @param4


      So, i need to list the templates that have, at least, 1 param without a specific value, in only 1 line, but with this query:



      select T1.Name, T3.Value
      from T1 inner join T2
      on T1.ID = T2.Template_ID
      inner join T3
      on T2.ID = T3.Param_ID
      where T3.Value like '@%';


      I got 2 lines as a result. The problem is, I have a system over oracle DB and I can't do my own queries or change the DB parameters, only select the columns of the tables (or use only this 4 functions max, min, sum and count over the columns) and the system do all the query by itself, so, I can't use big tricks on 'where' or 'order by' clause (force NLS_SORT as Binary, or use ROWNUM = 1, for example). So, my only idea is use another character instead of @ to identify the default params, to use MAX or MIN function over the T3.Value, but the character needs to be, for sure, the first or the last one in the WEST_EUROPEAN sort and I can't find anywhere which is the sort order of this. Can anyone help me?







      sql oracle nls-sort






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 10:27







      Alessandro Melo

















      asked Nov 12 '18 at 20:14









      Alessandro MeloAlessandro Melo

      225




      225
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Does list of functions you are allowed to use include LISTAGG? If so, it will return the result in 1 line. Here's an example:



          SQL> with
          2 t1 (id, name) as
          3 (select 1, 'template1' from dual),
          4 t2 (id, template_id, params) as
          5 (select 1, 1, '@param1' from dual union all
          6 select 2, 1, '@param2' from dual union all
          7 select 3, 1, '@param3' from dual union all
          8 select 4, 1, '@param4' from dual
          9 ),
          10 t3 (id, param_id, value) as
          11 (select 1, 1, 'xyz' from dual union all
          12 select 2, 2, '@param2' from dual union all
          13 select 3, 3, '1' from dual union all
          14 select 4, 4, '@param4' from dual
          15 )
          16 select t1.name, listagg(t3.value, ',') within group (order by t3.value) params
          17 from t1 join t2 on t1.id = t2.template_id
          18 join t3 on t3.param_id = t2.id
          19 where t3.value like '@%'
          20 group by t1.name;

          NAME PARAMS
          --------- --------------------
          template1 @param2,@param4

          SQL>





          share|improve this answer





















          • It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
            – Alessandro Melo
            Nov 13 '18 at 10:26











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269434%2fcharacter-order-of-nls-sort-west-european%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Does list of functions you are allowed to use include LISTAGG? If so, it will return the result in 1 line. Here's an example:



          SQL> with
          2 t1 (id, name) as
          3 (select 1, 'template1' from dual),
          4 t2 (id, template_id, params) as
          5 (select 1, 1, '@param1' from dual union all
          6 select 2, 1, '@param2' from dual union all
          7 select 3, 1, '@param3' from dual union all
          8 select 4, 1, '@param4' from dual
          9 ),
          10 t3 (id, param_id, value) as
          11 (select 1, 1, 'xyz' from dual union all
          12 select 2, 2, '@param2' from dual union all
          13 select 3, 3, '1' from dual union all
          14 select 4, 4, '@param4' from dual
          15 )
          16 select t1.name, listagg(t3.value, ',') within group (order by t3.value) params
          17 from t1 join t2 on t1.id = t2.template_id
          18 join t3 on t3.param_id = t2.id
          19 where t3.value like '@%'
          20 group by t1.name;

          NAME PARAMS
          --------- --------------------
          template1 @param2,@param4

          SQL>





          share|improve this answer





















          • It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
            – Alessandro Melo
            Nov 13 '18 at 10:26
















          0














          Does list of functions you are allowed to use include LISTAGG? If so, it will return the result in 1 line. Here's an example:



          SQL> with
          2 t1 (id, name) as
          3 (select 1, 'template1' from dual),
          4 t2 (id, template_id, params) as
          5 (select 1, 1, '@param1' from dual union all
          6 select 2, 1, '@param2' from dual union all
          7 select 3, 1, '@param3' from dual union all
          8 select 4, 1, '@param4' from dual
          9 ),
          10 t3 (id, param_id, value) as
          11 (select 1, 1, 'xyz' from dual union all
          12 select 2, 2, '@param2' from dual union all
          13 select 3, 3, '1' from dual union all
          14 select 4, 4, '@param4' from dual
          15 )
          16 select t1.name, listagg(t3.value, ',') within group (order by t3.value) params
          17 from t1 join t2 on t1.id = t2.template_id
          18 join t3 on t3.param_id = t2.id
          19 where t3.value like '@%'
          20 group by t1.name;

          NAME PARAMS
          --------- --------------------
          template1 @param2,@param4

          SQL>





          share|improve this answer





















          • It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
            – Alessandro Melo
            Nov 13 '18 at 10:26














          0












          0








          0






          Does list of functions you are allowed to use include LISTAGG? If so, it will return the result in 1 line. Here's an example:



          SQL> with
          2 t1 (id, name) as
          3 (select 1, 'template1' from dual),
          4 t2 (id, template_id, params) as
          5 (select 1, 1, '@param1' from dual union all
          6 select 2, 1, '@param2' from dual union all
          7 select 3, 1, '@param3' from dual union all
          8 select 4, 1, '@param4' from dual
          9 ),
          10 t3 (id, param_id, value) as
          11 (select 1, 1, 'xyz' from dual union all
          12 select 2, 2, '@param2' from dual union all
          13 select 3, 3, '1' from dual union all
          14 select 4, 4, '@param4' from dual
          15 )
          16 select t1.name, listagg(t3.value, ',') within group (order by t3.value) params
          17 from t1 join t2 on t1.id = t2.template_id
          18 join t3 on t3.param_id = t2.id
          19 where t3.value like '@%'
          20 group by t1.name;

          NAME PARAMS
          --------- --------------------
          template1 @param2,@param4

          SQL>





          share|improve this answer












          Does list of functions you are allowed to use include LISTAGG? If so, it will return the result in 1 line. Here's an example:



          SQL> with
          2 t1 (id, name) as
          3 (select 1, 'template1' from dual),
          4 t2 (id, template_id, params) as
          5 (select 1, 1, '@param1' from dual union all
          6 select 2, 1, '@param2' from dual union all
          7 select 3, 1, '@param3' from dual union all
          8 select 4, 1, '@param4' from dual
          9 ),
          10 t3 (id, param_id, value) as
          11 (select 1, 1, 'xyz' from dual union all
          12 select 2, 2, '@param2' from dual union all
          13 select 3, 3, '1' from dual union all
          14 select 4, 4, '@param4' from dual
          15 )
          16 select t1.name, listagg(t3.value, ',') within group (order by t3.value) params
          17 from t1 join t2 on t1.id = t2.template_id
          18 join t3 on t3.param_id = t2.id
          19 where t3.value like '@%'
          20 group by t1.name;

          NAME PARAMS
          --------- --------------------
          template1 @param2,@param4

          SQL>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 20:26









          LittlefootLittlefoot

          20.6k71433




          20.6k71433












          • It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
            – Alessandro Melo
            Nov 13 '18 at 10:26


















          • It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
            – Alessandro Melo
            Nov 13 '18 at 10:26
















          It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
          – Alessandro Melo
          Nov 13 '18 at 10:26




          It's a good solution, but unfortunately no, I can't use listagg, only the 4 that I mention
          – Alessandro Melo
          Nov 13 '18 at 10:26


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269434%2fcharacter-order-of-nls-sort-west-european%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma