Cursor in select query in row to column format

Hi
I have the query like below
SELECT d.department_id,
             CURSOR(SELECT e.first_name,
                     e.last_name
              FROM   employees e
              WHERE  e.department_id = d.department_id
       ) emps
FROM   depatments dI want the result set in a format of Row To columns like
10                             20
<cursor result>   <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with this

vishnu prakash wrote:
Hi
I have the query like below
SELECT d.department_id,
CURSOR(SELECT e.first_name,
e.last_name
FROM   employees e
WHERE  e.department_id = d.department_id
) emps
FROM   depatments dI want the result set in a format of Row To columns like
10                             20
<cursor result>   <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with thisNumber of column of a select query is static. Must be known at the parsing time itself. But in your case i dont think the number of columns will be limited to 2 (10 and 20) there could be many more.
You can search this forum to see how to PIVOT your data. There are lot of example. You can also try dynamic pivot. Its all in here, just search.

Similar Messages

  • Cursor in select query

    how i use cursor in select query ?
    I have 2 table
    1. emp
    2. dept
    i want output like
    Manager
    a
    b
    c
    Clark
    d
    e
    f
    HOD
    g
    h
    i
    by using cursor

    We wouldn't help you to learn something if we just give you an answer.
    Show some effort by yourself first, then ask what specific problem you encountered and you'll find this forum much more willingness to help.

  • Select query for rows where condition 1

    Say I have a table, tb1, that has the following entries:
    FName LName
    Code
    John Doe
    xxx
    Jane Doe
    xxx
    Steve Harper
    x
    Barrak Obama
    x
    George Bush
    xxxx
    Bill Clinton
    xx
    I'd like to write a select query that only lists the rows where the count for Code is > 1, i.e not display the last two rows from the above entry. How would I go about writing that select query.
    Thanks.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> Say I have a table, tb1, that has the following entries: <<
    Are you this rude or really ignorant and too lazy to read the Netiquette at the start to this forum? Why do you think you do not need a key? No DDL? No constraints? And , why, why do you think that “tb1” is a precise, ISO-11179 conforming table name? 
    Let's make this a table of rude posters rated on a 4-star scale. 
    CREATE TABLE Rude_Posters
    (first_name VARCHAR(15) NOT NULL, 
     last_name VARCHAR(15) NOT NULL, 
     PRIMARY KEY (first_name, last_name), 
     rudeness_code VARCHAR (4) NOT NULL
       CHECK (rudeness_code IN ('x', 'xx', 'xxx', 'xxxx'));
    INSERT INTO Rude_Posters
    VALUES
    ('John', 'Doe', 'xxx'), 
    ('Jane', 'Doe', 'xxx'), 
    ('Steve', 'Harper', 'x'), 
    ('Barrack', 'Obama', 'x'), 
    ('George', 'Bush', 'xxxx'), 
    ('Bill', 'Clinton', 'xx');
    >> I'd like to write a SELECT query that only lists the rows where the count for rudeness_code is > 1, i.e not display the last two rows from the above entry. << 
    The rudeness scale is based on stars, so to ask for an integer value is like saying “on a scale from 1 to 10, what is the color of your favorite letter of the alphabet?”
    Next, the number of stars and your narrative do not match. Did you want to say WHERE rudeness_code IN ('xx' 'xxx', 'xxxx')? 
    Please stop programming SQL until you have gotten more education. At this point, you do not know enough to ask a question. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Report Writer Row and Column Format

    Hi
    Was wondering if there is a possible solution to this :-
    Understand that column format is controlled by format groups. This means that all figures in the same column will take the same format (such as scaling and decimal place).
    Scenario is ->
                        Colunn #1 -> column set as displaying no decimal point       
    Rev                  120
    OP                      5
    OP margin %     4.2 -> how to set this to 1 decimal point. Any formula syntax that I can use?
    Regards.

    Hi Vinay,
    Based on my research, freezing row and column headers are different in table and matrix.
    In a table, if we want to freeze column header, we should make the changes in the first Static row group in Row Groups pane with Advanced Mode as you said. If we want to freeze row header, the table should have a group ahead, then we can enable “Repeat header
    rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    In a matrix, if we want to freeze column header, we can enable “Repeat header columns on each page” and “Keep header visible while scrolling” options in Column Headers in Tablix Properties dialog box. If we want to freeze row header, we can enable “Repeat
    header rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Select Query with diagonally  matching columns

    hi
    the following is the table struncture and insert statements
    create table emp_trans values (empno number , emptran_no number, prev_amount number, current_amount number)
    insert into emp_trans values(102,109,0,20);
    insert into emp_trans values(102,119,10,20);
    insert into emp_trans values(102,129,20,30);
    insert into emp_trans values(102,139,30,0);
    insert into emp_trans  values(201,101,0,20);
    insert into emp_trans values(201,110,20,30);
    insert into emp_trans values(201,120,0,30);
    insert into emp_trans values(201,130,30,20);
    insert into emp_trans values(201,140,0,20);In the table we can see some mappings as follows
    The data is on empno basis.
    we have 2 employees with empno 201 and 102 . Each empno has different emptrans_no. Need not be in an sequence.
    we need to select the set of records where prev_amount column matches with the current_amount column values for
    the previous record for every individual empno.
    prior to that the following basic select statement can be considered
    select * from emp_trans  order by empno , emptran_nofor ex:
    emp no 102 emptran_no 129 prev_amount column having values of 20 matches with the current_amount column having values 20
    with emptran_no 119.
    for empno 201 with emptran_no 110 we can see the prev_amount column having value 20 matched with current_account column havig values of 20
    of previous emptran_no 101 for the same empno 201.
    something like we need to see the diagnally mathced values.
    Any help on such query most welcome.
    Regards,

    Hi,
    sri wrote:
    Hi
    A small Change required
    For empno 201 we need to display
    EMPNO EMPTRAN_NO PREV_AMOUNT CURRENT_AMOUNT
    102 129 20 30
    102 139 30 0
    201 *120* 20 30
    201 130 30 20
    rathe than
    EMPNO EMPTRAN_NO PREV_AMOUNT CURRENT_AMOUNT
    102 129 20 30
    102 139 30 0
    201 *110* 20 30
    201 130 30 20Always explain how you get the results you want. Otherwise, the solution that works on your sample data won't necessarily work on your real data.
    Given that the data for empno=201 is:
    insert into emp_trans values (201, 101,  0, 20);
    insert into emp_trans values (201, 110, 20, 30);
    insert into emp_trans values (201, 120,  0, 30);
    insert into emp_trans values (201, 130, 30, 20);
    insert into emp_trans values (201, 140,  0, 20);Why do you want the row with emptrn_no=120, and not the row with emptran_no=110?
    If you want the row with emptran_no=120, why don't you want the row with emptran_no=101?
    If you want the row with emptran_no=130, why don't you want the row with emptran_no=110?
    can u please let me know the way you formatted the code for the query and sample output This site noramlly compresses whitespace.
    Whenever you post formatted text (such as query results) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query Designer - Rows between Columns

    Dear all,
    I've got the following requirement and I really cannot figure out if it is doable.
    I would appreciate your help.
    I shall create a query using Sap Query Designer regarding the actual and budet data of the assets (it's a financial report).
    I'll have 2 columns for the actual data and 2 columns for the budget data.
    Is there any way:
    a) to have the assets (the rows) in the middle of the report layout, and
    b) the actual data on the left side of the assets, and
    c) the budget data on the right side of the assets
    The goal is when drilling down the assets, both pairs of columns to be expanded as well.
    Is it doable? Is there any trick?
    Thanks in advance.

    Dear Riyez
    I do thank you for your response.
    I am wondering if there is something someone could possibly do on the Query Designer side in order to fool the system.
    For instance, to design a virtual structure (I do not know how - I am thinking loudly) which would be identical to the structure that holds the assets?
    In other words, is it designeable to have a row structure, then the column key figures and, finally, another row structure identical to the first one? And when the user expands the first structure, the second structure will follow accordingly?
    Or such a solution is out of question?

  • Query for rows as columns

    Hi,
    i have one table temp1:
    select * from temp, it's display:
    id name add
    1 xx xx1
    2 yy yy1
    3 zz zz1
    But i want display like this:
    1 2 3
    xx yy zz
    xx1 yy1 zz1
    Help me on this.....

    still problem not solveing.
    help me on this.
    normal output:
    1     xx     xx1
    2     yy     yy1
    3     zz     zz1
    Actual output:
    1     2     3..............................
    x     yy     zz..............................
    xx1     yy1     zz1.................................

  • Display Query Output - Rows as Columns

    Hi ,
    I am fetching data as follows.
    ITEM CODE, DESCRIPTION, UOM, PRICELISTNAME, PRICELISTVALUE
    Item can exists in more than one price list.
    I want get the output as follows
    ITEM CODE, DESCRIPTION, UOM, PLIST1 PLIST2
    X X X PLIST VAL1 PLISTVAL2
    Y Y Y PLISTVAL2
    Item X exists in PLIST1 and PLIST2, but, item Y exists in only Plist2.
    Can this be possible. Please let me know, if some one as solution for this requirement.
    Regards/Prasanth

    ITEM CODE...DESCRIPTION....UOM.......PLIST1.......PLIST2
    X..................X.........................X.............PLVAL1.....PLVAL2
    Y.................Y.........................Y..............................PLVAL2

  • Can I display detail row as column format which is aligned vertically?

    I have some data stored in table like this:
    Column:  Item     |   FOB   |    Exchange Rate  |  UOM
    Data:      Item A       1.1               0.9                  pcs
                  Item B       1.2               0.85                box
    Can I display them in Crystal report like this?
                        Item A         Item B
    "FOB"             1.1             1.2
    "Exg Rate"      0.9             0.85
    "UOM"            pcs             box
    The data all above are needed to shown, it's somewhat like a crosstab, but looks like not exactly.
    I am wondering whether I need to create dummy resultset to make it like:
    Item A,   FOB,         1.1
    Item A,   Exg Rate,  0.9
    Item A,   UOM,        pcs
    Item B,   FOB,         1.2
    Item B,   Exg Rate,  0.85
    Item B,   UOM,        box

    I think I should make my new question more clearly:
    Actually I would like to make my crosstab as below because I would like to add some formula fields into it.
    Dtl* fields are DB column field;  Fml* are formula fields and would possibly refer to other Dtl* fields
        Group A         |     Group B
    DtlA    FmlA      |    DtlA     FmlA
    DtlB   <empty>  |    DtlB
    DtlC    FmlC      |    DtlC     FmlC
    Say my example would be:
         Item A            |       Item B
    11       11 * 0.9    |     2         2 * 0.85
    0.9                     |   0.85
    pcs     11 pcs      |    box      2 box

  • How do I select the end of a row or column in Numbers?

    I am trying to select to the end of a column in Numbers. In Excel, I simply hold down the shift+command+arrow keys and I can select the entire row or column int he arrow direction. How do I do this in Numbers?

    Here two other scripts :
    Select-to-top and select-to-left.
    Both of them take care of possible headers.
    --{code}
    --[SCRIPT select-to-top]
    Enregistrer le script en tant que Script : select-to-top.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Utilisateurs:<votreCompte>:Bibliothèque:Scripts:Applications :Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une ou plusieurs cellules d'une ligne dans une table de Numbers
    Aller au menu Scripts , choisir Numbers puis choisir “select-to-top”
    Il étendra la sélection jusqu'à la première ligne standard de la colonne (ne sélectionne pas les rangs d’en tête).
    Bien entendu, ce script sera plus intéressant si vous le dotez d'un raccourci clavier à l’aide, par exemple, de FastScripts.
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script: select-to-top.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select one or several cells in a row of a Numbers table.
    Go to the Scripts Menu, choose Numbers, then choose “select-to-top”
    It will expand the selection to the first standard row of the table (minus header rows).
    Of course, it would be more useful if you attach a shortcut thanks to a tool like FastScripts.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2012/02/09
    --=====
    on run
              my activateGUIscripting()
              set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
              tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
                        set count_HeaderRows to my countXers("Numbers", "R")
                        set selection range to range ((name of cell (1 + count_HeaderRows) of column colNum1) & " : " & (name of cell rowNum1 of column colNum2))
              end tell
    end run
    --=====
    set { dName, sName, tName,  rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    on get_SelParams()
              local d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2
              tell application "Numbers" to tell document 1
                        set d_Name to its name
                        set s_Name to ""
                        repeat with i from 1 to the count of sheets
                                  tell sheet i to set maybe to the count of (tables whose selection range is not missing value)
                                  if maybe is not 0 then
                                            set s_Name to name of sheet i
                                            exit repeat
                                  end if -- maybe is not 0
                        end repeat
                        if s_Name is "" then
                                  if my parleAnglais() then
                                            error "No sheet has a selected table embedding at least one selected cell !"
                                  else
                                            error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"
                                  end if
                        end if
                        tell sheet s_Name to tell (first table where selection range is not missing value)
                                  tell selection range
                                            set {top_left, bottom_right} to {name of first cell, name of last cell}
                                  end tell
                                  set t_Name to its name
                                  tell cell top_left to set {row_Num1, col_Num1} to {address of its row, address of its column}
                                  if top_left is bottom_right then
                                            set {row_Num2, col_Num2} to {row_Num1, col_Num1}
                                  else
                                            tell cell bottom_right to set {row_Num2, col_Num2} to {address of its row, address of its column}
                                  end if
                        end tell -- sheet…
                        return {d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2}
              end tell -- Numbers
    end get_SelParams
    --=====
    on parleAnglais()
              local z
              try
                        tell application "Numbers" to set z to localized string "Cancel"
              on error
                        set z to "Cancel"
              end try
              return (z is not "Annuler")
    end parleAnglais
    --=====
    on activateGUIscripting()
      (* to be sure than GUI scripting will be active *)
              tell application "System Events"
                        if not (UI elements enabled) then set (UI elements enabled) to true
              end tell
    end activateGUIscripting
    --=====
    set count_Row_Headers to my countXers("Numbers","R")
    set count_Column_Headers to my countXers("Numbers","C")
    set count_Footers to my countXers("Numbers","F")
    set count_Row_Headers to my countXers("Pages","R")
    set count_Column_Headers to my countXers("Pages","C")
    set count_Footers to my countXers("Pages","F")
    on countXers(theApp, what)
              local mt, mi, mm, ms
              if theApp is "Numbers" then
                        set mt to 6 (* Table *)
                        if "Row" starts with what then
                                  set mi to 10
                        else if "Column" starts with what then
                                  set mi to 11
                        else if "Footer" starts with what then
                                  set mi to 14
                        else
                                  if my parleAnglais() then
                                            error "“" & what & "” isn’t a valid parameter !"
                                  else
                                            error "« " & what & " » n’est pas un paramètre géré !"
                                  end if -- parleAnglais
                        end if -- "Row"…
              else if theApp is "Pages" then
                        set {mt, mi} to {6, 4} (* Format, Table *)
                        if "Row" starts with what then
                                  set mm to 13
                        else if "Column" starts with what then
                                  set mm to 14
                        else if "Footer" starts with what then
                                  set mm to 15
                        else
                                  if my parleAnglais() then
                                            error "“" & what & "” isn’t a valid parameter !"
                                  else
                                            error "« " & what & " » n’est pas un paramètre géré !"
                                  end if -- parleAnglais
                        end if -- "Row"…
              else
                        if my parleAnglais() then
                                  error "The application “" & theApp & "” isn’t driven by this script !"
                        else
                                  error "L’application « " & theApp & " » n’est pas gérée par ce script !"
                        end if -- parleAnglais
              end if -- theApp…
      activate application theApp
              tell application "System Events" to tell process theApp to tell menu bar 1 to tell menu bar item mt to tell menu 1 to tell menu item mi to tell menu 1
                        if theApp is "Numbers" then
    Here we are in Numbers *)
                                  repeat with ms from 1 to 6
                                            try
                                                      (get value of attribute "AXMenuItemMarkChar" of menu item ms) = "✓"
                                                      exit repeat
                                            end try
                                  end repeat
                        else
    Here we are in Pages *)
                                  tell menu item mm to tell menu 1
                                            repeat with ms from 1 to 6
                                                      try
                                                                (get value of attribute "AXMenuItemMarkChar" of menu item ms) = "✓"
                                                                exit repeat
                                                      end try
                                            end repeat
                                  end tell -- menu item mm
                        end if -- theApp is …
              end tell -- System Events…
              return ms - 1
    end countXers
    --=====
    --[/SCRIPT]
    --{code}
    --{code}
    --[SCRIPT select-to-left]
    Enregistrer le script en tant que Script : select-to-left.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Utilisateurs:<votreCompte>:Bibliothèque:Scripts:Applications :Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une ou plusieurs cellules d'une colonne dans une table de Numbers
    Aller au menu Scripts , choisir Numbers puis choisir “select-to-left”
    Il étendra la sélection jusqu'à la première colonne standard de la table (ne sélectionne pas les colonnes d’en tête).
    Bien entendu, ce script sera plus intéressant si vous le dotez d'un raccourci clavier à l’aide, par exemple, de FastScripts.
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script: select-to-left.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select one or several cells in a column of a Numbers table.
    Go to the Scripts Menu, choose Numbers, then choose “select-to-left”
    It will expand the selection to the first standard colomn of the table (minus fheader columns).
    Of course, it would be more useful if you attach a shortcut thanks to a tool like FastScripts.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2012/02/09
    --=====
    on run
              my activateGUIscripting()
              set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
              tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
                        set count_ColHeaders to my countXers("Numbers", "C")
                        set selection range to range ((name of cell (1 + count_ColHeaders) of row rowNum1) & " : " & (name of cell colNum1 of row rowNum2))
              end tell
    end run
    --=====
    set { dName, sName, tName,  rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    on get_SelParams()
              local d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2
              tell application "Numbers" to tell document 1
                        set d_Name to its name
                        set s_Name to ""
                        repeat with i from 1 to the count of sheets
                                  tell sheet i to set maybe to the count of (tables whose selection range is not missing value)
                                  if maybe is not 0 then
                                            set s_Name to name of sheet i
                                            exit repeat
                                  end if -- maybe is not 0
                        end repeat
                        if s_Name is "" then
                                  if my parleAnglais() then
                                            error "No sheet has a selected table embedding at least one selected cell !"
                                  else
                                            error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"
                                  end if
                        end if
                        tell sheet s_Name to tell (first table where selection range is not missing value)
                                  tell selection range
                                            set {top_left, left_right} to {name of first cell, name of last cell}
                                  end tell
                                  set t_Name to its name
                                  tell cell top_left to set {row_Num1, col_Num1} to {address of its row, address of its column}
                                  if top_left is left_right then
                                            set {row_Num2, col_Num2} to {row_Num1, col_Num1}
                                  else
                                            tell cell left_right to set {row_Num2, col_Num2} to {address of its row, address of its column}
                                  end if
                        end tell -- sheet…
                        return {d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2}
              end tell -- Numbers
    end get_SelParams
    --=====
    on parleAnglais()
              local z
              try
                        tell application "Numbers" to set z to localized string "Cancel"
              on error
                        set z to "Cancel"
              end try
              return (z is not "Annuler")
    end parleAnglais
    --=====
    on activateGUIscripting()
      (* to be sure than GUI scripting will be active *)
              tell application "System Events"
                        if not (UI elements enabled

  • How to select rows or columns of tables without using the mouse?

    2nd post ever! Yeah! \m/
    In Excel, I can select entire rows or columns of data WITHIN TABLES--i.e., not selecting entire sheet rows or columns--by going to any cell on the perimeter of the table, holding down shift+ctrl, and clicking a direction arrow. So for example, if I have a table in columns D-G and rows 1-5, I can highlight row 4 by going to the first or last cell of that row, holding down the shift+ctrl, and hitting the appropriate direction arrow. You might think this is superfluous given that you can use the mouse to select cells. But that becomes cumbersome with large tables, and this method can be more efficient even with small tables.
    Similarly, it's often useful to navigate tables, particularly large ones, by moving from any cell within the table to the end or beginning of that row or column by holding down ctrl and hitting the appropriate arrow key. In Excel, this ctrl+arrow key method also allows you to skip blank cells, which is another very useful navigational feature.
    I tried numerous combos involving shift, ctrl, command, alt/option and the arrow keys. Haven't found a way to do any of this yet.
    Anyone?

    Hi Josh,
    Numbers is organized differently than Excel, and the navigation tools are different too. Many of us miss our particular favorites from spreadsheets past, but this is Numbers, not a clone. The biggest adjustment is to go from huge monolithic sheet-tables containing virtual sub-tables to a simple blank sheet with small tables, sometimes many per sheet. Navigating is no big deal in these small tables and neither is getting from one small table to another, using the Sheets pane.
    Selecting a particular Table is as easy as clicking on the table's name in the Sheets pane. Selecting a particular row, or column, or ranges of rows or columns is done by clicking on the table's row and column labels, left side and top side once a cell is selected in the table.
    Numbers is weak at handling large Tables and documents that are large overall. We know this and many of us still prefer it to the alternative when the tool fits the task.
    Jerry

  • SELECT Query - Dynamic Coulmns

    Hi
    I need to write a query that will have dynamic number of columns depending on the present day of the month that is, if today is 13th November then the SELECT query should have 13 columns.
    Regards
    Kapil

    SQL does not deal with dynamic columns. The number of columns must be determined before data is retrieved so that the SQL engine knows what to get back.
    Whilst it's possible to use PL/SQL to write some dynamic SQL this is not really the correct place to be doing what you want. The nature of this requirement lies with a report generating tool, as these are generally designed to produce dynamic SQL in this way.
    As suggested, you would be better to write your SQL to produce 31 columns of information and then use your front end GUI to just show the columns that are required, OR use a report generator to dynamically build the query in the first place.

  • Report column format specification

    I know, I can use TO_CHAR function in the SQL query to specify the column format for a user defined report. But, there is a separate tab for formatting columns when you creating a new report.
    Does anyone know how to specify the column format in the "Create Report Dialog" box?
    I tried with "999,999.99" and "###,###.##", doesn't seem to work.
    Thanks,
    Senthil.

    Itt appears that on Vista/11G/SQLDev 5440 in the Create report dialog ..
    report child query column formatting is lost (not saved)
    report parent query column formatting according to java formats detailed here http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html
    such as ###,### do not take effect

  • Convert columns to rows by a select query

    I have a table with 10 columns. Pk is combination of 3 columns, let us say A, B and C. I need a select query which returns 7 rows with four columns each let us say A,B,C and D where D contains the value of non PK column. i.e. for first row, D will contain value of fourth column of the table, for second row, D will contain fifth column of the table and so on.
    Please help.

    Maybe NOT TESTED!
    select col_a,col_b,col_c,column_4 col_d
      from (select col_a,col_b,col_c,col_d,col_e,col_f,col_g,col_h,col_i,col_j
              from the_table
    unpivot include nulls (column_4 for source_column in (col_d as 'col_d',
                                                          col_e as 'col_e',
                                                          col_f as 'col_f',
                                                          col_g as 'col_g',
                                                          col_h as 'col_h',
                                                          col_i as 'col_i',
                                                          col_j as 'col_j'
                          )Regards
    Etbin

  • How to create a Type Object with Dynamic select query columns in a Function

    Hi Every One,
    I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
    I have tried by
    SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
    c :=DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
    l_status := DBMS_SQL.EXECUTE(c);
    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
    END LOOP;
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.COLUMN_VALUE(c,j,v_val);
    END LOOP;
    But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
    Thanks,
    mallikj2

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

Maybe you are looking for