SQL result

If I use SqlDataAccess sda;
QVariant result;
result = sda.execute ("SELECT column FROM table where...");
How to get I store the result in a table of QString? With c ++ to perform tests on this subject?
Help, please

I found the answer.

The index as you have already said, is to go to QVariant to QVariantMap;

and here's how it might be-->

QVariant result;QString string [10]; // example
result = sda.execute("SELECT column FROM table WHERE ...");
QVAriantList list = result.value();
QVariantMap map = list[i].toMap(); // to get each item if a loop for
string[i] = map["column"].toString; // in the loop

Tags: BlackBerry Developers

Similar Questions

  • JSON to the sql result set

    Hi all

    I have this requirement to convert the JSON format in the result set (with the lines and columns).

    is their in any case I can achieve this?

    I was able to successfully convert the sql result set in JSON format but difficult time to do the reverse.

    Flexibility:

    At some point, I expect the lines to return no more than 2 & about 50 columns maximum.

    Therefore, the JSON itself can be stored in varchar2 (4000) and not need to use CLOB. (If necessary to be passed as an argument to the function).

    Oracle version: 11.2.0.3

    Kind regards

    AAG

    There are at least the son on this site below:

    https://community.Oracle.com/thread/2505918

    https://community.Oracle.com/thread/3634280

    https://community.Oracle.com/thread/3557925

    https://community.Oracle.com/thread/2510292

  • Export a sql result with the right button of the mouse

    We do not have the ability to export the sql result to in Developer SQL EA 3.0.4. I have very difficult ofr me, because all day in my service allows us to export to excel or export format insert,...

    We have 2 versions of the SQL (3 and 2.1) developer only because there is no such thing as this feature in 3.0.

    Do you have a solution for Developer SQL EA 3.0?

    In the EA, it's called Unload , but do not get 3.0 production, where he's back for the export .

    Have fun
    K.

  • dash line, show by sql result

    Hi, there are 2 choices to view the results for the guest (choices in the command prompt).

    "All values" and "SQL result."

    I found that for all values, the results are SEPARATE.
    for SQL result, if the sql code is "select... from...» ', the results may be unique (choice duplicated in the command prompt)
    If the sql code is "select DISTINCT... of...» ", the results are still not unqiue (double choice in the command prompt).

    is this a bug? or SEPARATE only is not supported?

    Hello

    I don't think that there is a need to SEPARATE in the select clause. Default BI Server will apply separate in the application and go to the database. This is true for all non-primary key columns only specific columns. Here is an example,

    There are some duplicate values in the column of the subregion. But even if I give the sql code following in guest of dashboard for the 'Results' option it again retrieves unique records.

    SELECT customers. Sub-region of countries "OF HS

    BI Server generated query:
    Select distinct T175. COUNTRY_SUBREGION C1
    Of
    SH COUNTRY T175

    Kind regards

  • Add the variable of presentation in a prompt SQL results

    Hello friends!

    I have a prompt with the time Dimension (year (p.v. v_year) and month (p.v. v_month)). Then I have another guest of departments in the same page and I want to compel departments depends on my year and selected months before.

    I know to do with variable presentation, if I go to SQL results in prompt Department and ADD the following: "WHERE"Sun Time"." Year=@{v_year}"it works but I want to add months also!

    How can I do?


    Thank you very much!!!

    Hello

    Use single quotes...
    "like... month = ' @{var_month}"

    hope this can work...

  • Pivot SQL results

    Hello

    Can someone help me with a request to one of our business units.

    We have pieces of equipment that have IDS and descriptions. A piece of equipment can have between 0 and n descriptions. Most have 1 desc, some don't any others maybe 5 or 6.

    Therefore, currently the .NET application presents the data as follows (I've simplified it a lot...)

    Select equipment_id, desc

    of equipment_desc;

    equipment_id / / desc

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

    12345 xxxxx

    yyyyy 12345

    zzzzz 12345

    NULL 98765

    KKKKK 78910

    .

    .

    That request to the end-user at the moment is for data must be rotated and presented like this;

    equipment_id desc_1 desc_2 desc_3

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

    12345 xxxxx yyyyy-zzzzz

    NULL NULL NULL 98765

    KKKKK 78910 NULL NULL

    So, as you can see I still want 98765 even if there is no description.

    I did something similar to this was a CASE statement, but I knew exactly how much passes description there were, as mentioned previously, it is configurable, so it might be 0 or n?

    Guidance or advice much appreciated.

    Thank you

    AnnPricks E wrote:

    I think that in your case it had to rotate dynamic... I did something below to rotate dynamic. It will work for your case only, and is not a generic. You can try the below and let me know in case of any problems

    FUNCTION to CREATE or REPLACE dyn_row_colum

    RETURN SYS_REFCURSOR

    AS

    v_sqlstr VARCHAR2 (32767): = 'SELECT equipment_id,';

    v_rfcur SYS_REFCURSOR;

    v_cnt NUMBER;

    BEGIN

    SELECT MAX (COUNT (*)) IN v_cnt

    OF test_desc

    GROUP BY equipment_id;

    FOR j_rec IN 1.v_cnt

    LOOP

    v_sqlstr: = v_sqlstr | » '||' MAX (DECODE (rn,'|)) '''|| j_rec | " ((' |', description))' | ' ': ' desc_' | j_rec | «, » ;

    END LOOP;

    v_sqlstr: = RTRIM (v_sqlstr, ','). » '||' FROM (SELECT equipment_id, description, ROW_NUMBER () OVER (PARTITION BY equipment_id ORDER BY description) rn test_desc) GROUP BY equipment_id';

    V_rfcur OPEN FOR v_sqlstr;

    RETURN v_rfcur;

    EXCEPTION

    WHILE OTHERS THEN

    LIFT;

    END dyn_row_colum;

    VAR v_cursor REFCURSOR;

    EXEC: v_cursor: = dyn_row_colum;

    PRINTING v_cursor;

    SELECT dyn_row_colum FROM dual;

    Grand... and now you have a query that is generated dynamically, providing an unknown number of columns through a slider REF... so you're going to need either a 3rd layer application of party which can cope with a projection of a ref cursor dynamic SQL or you will have to write code PL/SQL dynamic to manage dynamic results. or, if in 11g, use the DBMS_SQL package to convert the ref cursor in a DBMS_SQL cursor and uses the code to analyze and process the results of the query on a base of column position rather than on basis of name of column.  It's a lot of work and is likely to lead to problems of heavy maintenance.

    The real need to have a dynamic number of columns output is something that is often necessary to run reports on the data.

    As a result, most report writing tools are perfectly capable to query the data in the normal way and then rotate dynamically for the presentation of the report.

    SQL and PL/SQL are not the best tools for rotating dynamics.

  • Displaying a sql result differently.

    Hi, please read carefully and if you don't understand what I mean it please let me know.

    Here are the names of tables and columns in tables

    SYSTEM_USER_SKILL

    user_id

    skill_id

    user_abilities

    SYSTEM_ADMIN_SKILL

    skill_id

    skill_name

    SYSTEM_USER

    user_id

    user_full_name

    I want to write a sql dynmanic or a pl/sql that allows to display the user_full_name and the user_ability.

    but I want it to appear as (see link below)

    http://I61.Tinypic.com/fjhy5k.PNG

    PS where you see the "Y" and "N" are the results of user_abilities

    I don't know how to do all that I know is that it's possible with sql dynamic or pl/sql

    someone else has managed to help me using the same description that I posted here. He did it using only my description. I don't provide any code

    Violin SQL

  • How to fix SQL results in double

    Hi all

    I am Michel.

    I want to correct Oracle 11 g SQL statement
    on the view, the table is locked.

    The SQL class that can be created as follows.

    ----------------------------------------------------------------------
    SELECT
    "view the table is locked.
    V.INSTANCE_NAME,
    EU. NOM_SEGMENT
    OF SYS. V_$ SESSION SE, SYS. V_$ LOCK M, SYS. V_$ INSTANCE V, SYS. USER_EXTENTS EU
    WHERE EU. EXTENT_ID = 1
    AND ((SE. SID = M.SID
    AND M.REQUEST! = 0)
    OR (ES. SID = M.SID
    AND M.REQUEST = 0 AND LMODE! = 4
    AND (ID1, ID2) IN
    (SELECT S.ID1, S.ID2
    V $ LOCK S
    WHERE TO ASK! = 0
    AND S.ID1 = M.ID1
    AND S.ID2 = M.ID2)))
    ----------------------------------------------------------------------


    Deriving from the execution of SELECT, appear as shown below.

    ----------------------------------------------------------------------
    '' VIEWTHETABLEISLOCKED' ', ' INSTANCE_NAME', 'NOM_SEGMENT '.
    "view the table is locked ', 'hand',' employees_BK '.
    "view the table is locked ', 'hand', 'employees '.
    "view the table is locked ', 'hand',' employees_BK '.
    "view the table is locked ', 'hand', 'employees '.
    ----------------------------------------------------------------------


    Looking at the results of the foregoing and duplicate results are displayed.

    The feeling that without the high cost of SEPARATE,
    As described below, the SELECTION can be made that redundant.
    I want to change the SQL statement.

    ----------------------------------------------------------------------
    '' VIEWTHETABLEISLOCKED' ', ' INSTANCE_NAME', 'NOM_SEGMENT '.
    "view the table is locked ', 'hand',' employees_BK '.
    "view the table is locked ', 'hand', 'employees '.
    ----------------------------------------------------------------------

    How can I change the SQL for how I think that I enjoyed.

    Thank you and best regards.

    Michel Hi Please try this

    Select *from
    (
    SELECT
    'view the table is locked',V.INSTANCE_NAME,UE.SEGMENT_NAME,row_number() over(partition by V.INSTANCE_NAME,UE.SEGMENT_NAME order by null) rn
    FROM SYS.V_$SESSION SE, SYS.V_$LOCK M, SYS.V_$INSTANCE V,SYS.USER_EXTENTS UE
    WHERE UE.EXTENT_ID = 1
    AND ((SE.SID = M.SID
    AND M.REQUEST != 0)
    OR (SE.SID = M.SID
    AND M.REQUEST = 0 AND LMODE != 4
    AND (ID1, ID2) IN
    (SELECT S.ID1, S.ID2
    FROM V$LOCK S
    WHERE REQUEST != 0
    AND S.ID1 = M.ID1
    AND S.ID2 = M.ID2)))
    ) where rn=1
    
  • coil only the SQL result to a text file

    Hello

    Here's my script for getmetadata.sql. The sql script retrieves the metadata of objects for a schema specific to start from a specific date.

    Set serveroutput off
    the feeding off value
    fixed lines 200
    set of 2000 pages
    set verify off
    Set term on
    object_name format a30 column
    coil result_ddl.lst
    Select dbms_metadata.get_ddl (object_type, object_name). ';' from dba_objects where owner_name = '& schema_name' and to_date (to_char (created, 'DDMMYYYY'), 'DDMMYYYY') > = to_date ('& DDMMYYYY ', ' DDMMYYYY');

    In the hold with the result file I get the below lines too.

    "
    Enter the value of schema_name:CUSTOM
    Enter the date value: 08032011
    "

    I wish that this text does not do print and only the metadata script is created.
    Please guide.

    A - K wrote:
    Hello

    Here's my script for getmetadata.sql. The sql script retrieves the metadata of objects for a schema specific to start from a specific date.

    Set serveroutput off
    the feeding off value
    fixed lines 200
    set of 2000 pages
    set verify off
    Set term on
    object_name format a30 column
    coil result_ddl.lst
    Select dbms_metadata.get_ddl (object_type, object_name). ';' from dba_objects where owner_name = '& schema_name' and to_date (to_char (created, 'DDMMYYYY'), 'DDMMYYYY') > = to_date ('& DDMMYYYY ', ' DDMMYYYY');

    In the hold with the result file I get the below lines too.

    "
    Enter the value of schema_name:CUSTOM
    Enter the date value: 08032011
    "

    Is it really what you see? "Do not enter value for DDMMYYYY '?
    Be sure to view the results you get in fact from the code you post.

    I wish that this text does not do print and only the metadata script is created.

    Probably the best way is to explicitly set substritution variables before you start curling, like this:

    set serveroutput off
    set feed off
    set lines 200
    set pages 2000
    set verify off
    set term on
    column object_name format a30
    
    ACCEPT  schema_name       PROMPT "Please enter the schema name (case-sensitive, e.g. CUSTOM): "
    ACCEPT     ddmmyyyy       PROMPT "Please enter the minimum created date (DDMMYYY, e.g. 28022011): "
    
    spool result_ddl.lst
    
    select     dbms_metadata.get_ddl(object_type,object_name)
         ||     ';'
    from    dba_objects
    where      owner_name     ='&schema_name'
    and     created          >= to_date ('&DDMMYYYY', 'DDMMYYYY')
    ;
    
    ...
    

    Beware of round-trip conversions, such as

    to_date(to_char ...
    

    They are almost never necessary in Oracle. If you have a reason why you can't use just created, then it is almost certainly to get the same results without changing the types of data more efficiently (and less confusing).

  • Display SQL results in flash

    Hi all

    Can someone tell me how I would go about setting up flash to display the results returned by a query SQL, one at a time.  I can work on the query and PHP, but want I want to know, how to do flash take each of them and animate it, including the suspension and the compensation of the full screen, and then continues on a screen of 'new '.  That's essentially a list of events in a database.

    So, while watching the movie in action, you'd see

    White screen

    Event 1 (break)

    Tournament 2 (pause)

    Event 3 (pause)

    (make one pause and fade out)

    New screen

    Event 4

    Event 5

    Event 6

    .. and so on until all the results have been posted.

    Any help much appreciated.  In fact, it is possible that what I need is help as to how to achieve this returning from xml.  It's really the actionscript code that I am lost.

    Thank you

    James

    If you do not have a handle on the management of dynamic content in Flash, and then to the time you should focus on solving just this aspect and save with php/sql/xml eventually.  To creat now just a stufff array you want to treat it the way you want and it works from there.  Eventually, that's what you get when you feed the file, the data anyway.

    As far as the break and the animation of the aspects go, your best bet will be to search Google for a tutorial on perhaps a slideshow or marquee that runs automatically.  Understand how it works, and then find a way to turn it into something that suits your needs.

    The basic tools that you will be after will be the Tween class to animate the Timer class to trigger a break/motion, as well as their respective event listeners.  If you can find some simple tutorials just for these two things separately, you might be able to reason about the merger for what you are after.

  • Odd SQL results

    I have a SQL statement which shows a strange behavior. When I run the present:

    SELECT vfn.cat
    IN v_mult_category
    OF vfn, valid_fishery vf vps_fishery_ner
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = p_Fishing_Year
    AND vf.moratorium_fishery 't ='
    AND vfn.vp_num = p_permit_number
    AND vfn.ap_year = p_Fishing_Year
    AND vfn.plan = 'MUL '.
    AND date_issued = (SELECT MAX (date_issued)
    OF vps_fishery_ner vfn
    WHERE vfn.vp_num = p_Permit_Number
    AND vfn.ap_year = p_Fishing_Year);

    This is supposed to go back to the category "A" for the number of permits given and the fishing year.
    But it returns nothing. But when I add TRUNC at both sides of the line of date_issued, as seen below, it does not return the "a."

    SELECT vfn.cat
    OF vfn, valid_fishery vf vps_fishery_ner
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = 2010
    AND vf.moratorium_fishery 't ='
    AND vfn.vp_num = 111111
    AND vfn.ap_year = 2010
    AND vfn.plan = 'MUL '.
    AND TRUNC (date_issued) = (SELECT MAX (TRUNC (date_issued))
    OF vps_fishery_ner vfn
    WHERE vfn.vp_num = 111111
    AND vfn.ap_year = 2010);

    I don't know why it would work. If truncating the two sides works, should not do not truncate each side return a value?

    Well your subquery to set the maximum date is not all clauses that are in the body of the request. It therefore generates a maximum based on a larger result set then the dates you compare it with that.
    Coincidentally, the maximum date is the same day as one of the files in the body of the request, in order to for the truncated dates. but it's at a different time, so direct comparison does not work.

    It should work

    SELECT vfn.cat
    INTO v_mult_category
    FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = p_Fishing_Year
    AND vf.moratorium_fishery = 'T'
    AND vfn.vp_num = p_permit_number
    AND vfn.ap_year = p_Fishing_Year
    AND vfn.plan = 'MUL'
    AND date_issued = (SELECT MAX(date_issued)
    FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = p_Fishing_Year
    AND vf.moratorium_fishery = 'T'
    AND vfn.vp_num = p_permit_number
    AND vfn.ap_year = p_Fishing_Year
    AND vfn.plan = 'MUL');
    
  • want to extract two values from rows in a single sql result

    Let me first of all explain the situation

    I have two tables
    1 Animal_details(animal_id,and other details)
    2 Animal_weight(animal_id,seq_no,weight,date_weighed)

    in fact situation here is that for each weight I am inserting a new line with seq_no say
    1 for the first weight
    2 for the second weight...
    with their weight and date
    for example. animal_id = 1 seq_no = 1, weight = 200, date_weighed = 12-may-2000;
    animal_id = 1, seq_no = 2, weight = 250, date_weighed = June 12, 2000;

    means seq_no = 1 represents 1 weight of animals
    seq_no = 2 represents 2 weight of animals

    how an animal can have any number. weighted times.

    now what I want, I want to show a result with

    animal_id, weight_1, weight_2 with other animals details in a single line

    How can I get first weight and the second or more weight in the same line for any animal?

    Please answer soon, its urgency.

    Thank you

    You cannot issue a SQL with dynamic column list of 100%. What you can do is something like the questions:

    with t as (
               select  animal_id,
                       max(case seq_no = 1 then weight end) first_weight,
                       max(case seq_no = 2 then weight end) second_weight,
                       max(case seq_no = 3 then weight end) third_weight
                 from  animal _weight
                 where seq_no <= 3
                 group by animal_id
              )
    select  t1.animal_id,
            first_weight,
            second_weight,
            third_weight,
            other_details
      from  t t1,
            animal_details t2
      where t2.animal_id = t1.animal_id
    /
    

    SY.

  • Ask the events of trace sql result 10046 level 8 and 12

    Hi all, I read the result of events to trace sql 10046 level 8 on

    http://www.Oracle-base.com/articles/10G/SQLTrace10046TrcsessAndTkprof10g.php#trace_example

    and I do the level of Event 10046 SQL trace 8 or 12. But the results were not even, plan of execution does not appear

    How to make the execution plan appears?

    How to make the execution plan appears?

    TKProf trace_results.txt .trc explain = name of user and password

  • Modeling of a SQL result

    Hello! I have a Sql that returns
    col1 col2 col3 col4 col5
    1 1 0 1
    1 0 1 1
    0 1 B 0 0
    1 1 0 0
    0 1 B 0 0

    Assuming that the sentence: Select col1, col2, col3, col4 col5 table

    How I model the sentence to get this result:

    col1 col2 col3 col4 col5
    4 1 1 2
    B 0 0 1 0

    The columns col3, col4 y col5 are obtained by adding the result of each line. col1 and col2 is the only value that is displayed.

    Thanks in advance

    Search SELECT, GROUPBY, SUM... in the documentation, you

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_10002.htm#i2065646
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_10002.htm#i2182483
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions163.htm#i89126

    and then tell us please what you don't understand

  • When I filled a form field using a query SQL result is displayed but not registered in the table.

    I write in the topic, I have created a form and in some of their fields, I used a SQL query to get information from a table based on the user who has been logging.

    The information displayed well, but when I press "Send button" loses information and the field in the table is shown empty.


    Anyone know what is happening?

    I enclose below a picture of the problem

    Concerning

    Problema DB APEX.jpg

    Hi ANTHONY,.

    ANTHONY wrote:

    I give you the credentials of my database, I hope you could do it works and most importantly, showing me what the error care...

    Feel free to change what you want in the application

    https://Apex.Oracle.com/pls/Apex/f?p=4550:1:2838412118981:

    BANCO_PRUEBAS

    ADMIN

    password

    It is interesting that, when I use APEX 5.0.1.00.06, I have some errors form appearing not using APEX 4.1.0.00.32

    Check your 77569 application-> Page 1. I have modified the page element attributes. Now it's working.

    Here are the changes (I will explain for P1_NOMBRE, did the same for the P1_APELLIDOS and P1_CATEGORIA):

    • 'Source' has become article attributed to him include:

    Source: Replacement always, value that exists in session state

    Source type: column database

    Source of value or an expression: NUMBER

    • The "Default" article now the following attributes:

    By default of Type: PL/SQL function body

    Default value:

    DECLARE
    
      L_NOMBRE B_LISTA_EMPLEADOS.NOMBRE%TYPE;
    
    BEGIN
    
      select NOMBRE
      into   L_NOMBRE
      from   B_LISTA_EMPLEADOS
      where  USERNAME = :APP_USER;
    
      RETURN L_NOMBRE;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      RETURN NULL;
    
    END;
    

    Kind regards

    Kiran

Maybe you are looking for

  • Close slowly in the night and slow start morning

    I'm having this problem and does not know what it is. Slow closed at night and slow start in the morning and using the capture software and screen illustrated space left. I don't see how to repair disk permissions if it is my problem can anyone help

  • Dynamic user LV 2011 events ignore when you're already handling a

    Hello I have a UI which fires def dynamic events to control a process. These events are handled in a vi running in parallel. Say that the user has decided to fire an event of 'start', which is handled by the event handler, and now I would like to tha

  • Numerical analysis of the chain of extended precision

    I'm looking for a way to parse a string to an extended precision floating point digital. The Conversion of Numer/string "Scan value" built-in LabVIEW 2013 function returns a double. How can I get a JOB?

  • "Server error in ' / ' application", then the line "Runtime Error".

    Description: An application error occurred on the server. The current settigs error customized for this application prevent the details of the error in the application being viewed remotely (for security reasons). However, it could be read by browser

  • Cannot save to PDF

    I am currently using a program called profile (for tax purposes) and am forced to save/send my file in PDF format. I can't save a file in PDF format, although I have Adobe Acrobat installed. When it goes to print screen, it freezes and finally opens