Series of summation of Sigma in Sql


Hello

I'm trying to code in a series of Sigma (summation) in a SQL to Oracle (as opposed to pl/sql). I don't know if it's possible? I can't find a feature in Oracle that would give me this.

I am trying to model ∑ p (1 + r) ^ I

For the series I = 0 to n (r, in this case is a value of 0.5 rate - in this case, it is a constant, but could in the future be a variable)

Its actually a formula not disimiliar for the calculation of compound interest (except that it would be the sum of the values of compound interest - where the use of the Sigma)

any help appreciated,

Jim

Hi Jim,.

Try this

create or replace function fn_get_sum_extents

(number of start_in,

number of rate_in

Return number extent_in number)

is

number of sum_of_extents;

Start

sum_of_extents: = start_in * (1 - power (1 + rate_in, extent_in)) / (-rate_in);

Return sum_of_extents;

exception

while others then

return sqlcode;

end;

/

See the err

Col sum_extents to 999g990d00

Select fn_get_sum_extents (10, 5/10, amount) sum_extents

(amount of LEVEL SELECT

OF the double

CONNECT BY LEVEL< 6="" )="">

SUM_EXTENTS

-----------

10.00

25.00

47,50

81.25

131,88

concerning
Kay

Tags: Database

Similar Questions

  • best way to take a trace of a session

    Hello

    I always use dbms_system.set_ev (sid, serial #, trace_level...)

    What is the best way to take a trace of a session?
    There are other ways to run a trace of a session?

    See you soon,.

    EA

    Hello

    Here are a few ways to generate a trace:

    To activate the traces at the instance level

    (1) assign the parameter sql_trace the pfile or spfile. It will allow to trace for all sessions and the background
    process

    SQL_Trace = TRUE to enable or disable trace use sql_trace = FALSE

    (2) to activate the tracing without restarting the databasejust, run the following command using sqlplus:

    SQL > ALTER SYSTEM SET trace_enabled = TRUE; To start the trace
    SQL > ALTER SYSTEM SET trace_enabled = FALSE; To stop the trace

    To activate the traces at the session level

    If you need to generate trace your own sesion use:

    SQL > ALTER SESSION SET sql_trace = TRUE; to start the trace
    SQL > ALTER SESSION SET sql_trace = FALSE; to stop the trace

    or

    SQL > EXECUTE dbms_session.set_sql_trace (TRUE); to start the trace
    SQL > EXECUTE dbms_session.set_sql_trace (FALSE); to stop the trace

    or

    SQL > EXECUTE dbms_support.start_trace; to start the trace
    SQL > EXECUTE dbms_support.stop_trace; to stop the trace

    To enable tracing in a different session

    Discover the SID and the v SERIES No. $ session to help:

    SQL > SELECT * FROM v$ session WHERE osuser = OSUSER;

    and use:

    SQL > EXECUTE dbms_support.start_trace_in_session (SID, SERIAL #); to start the trace
    SQL > EXECUTE dbms_support.stop_trace_in_session (SID, SERIAL #); to stop the trace

    or

    SQL > EXECUTE dbms_system.set_sql_trace_in_session (SID, SERIAL #, TRUE); to start the trace
    SQL > EXECUTE dbms_system.set_sql_trace_in_session (SID, SERIAL #, FALSE); to stop the trace

    Please see this link for more information regarding the use of DBMS_MONITOR:

    * http://www.dbasupport.com/oracle/ora10g/session_tracing301.shtml

    Also take a look at this link:

    * http://www.ixora.com.au/scripts/dumps.htm

    See you soon,.

    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • SQL Querry has worked in the workshop of SQL but not in series AnyChart.

    Hello

    I use the following statement in SQL Workshop:

    T3.fname | NULL, select ' ' | T3. Lname label, to_char (to_date (t1.total_time, 'sssss'), 'mi: ss') Week_2_Time, t2.total_weight week2_weight

    evt_scr_board t1, evt_scr_board t2, t3 mem_profile

    where t1.mem_serno = t2.mem_serno

    and t1.evt_rnd = 1

    and t2.evt_rnd = 2

    and (t1.rx_cd = 'RX' and t1.evt_rnd = 1)

    and (t2.rx_cd = 'RX' and t2.evt_rnd = 2)

    and t3.mem_serno = t1.mem_serno

    It produces the following as expected:

    Screenshot 2014-11-14 09.34.09.png

    However when I run the same querry in a series of anychart page shows "No Data".

    Screenshot 2014-11-14 09.36.12.png

    The querry works fine if I don't need to convert the number to a date format. Any help would be greatly appreciated.

    Thank you!!!

    Syntax for a series is:

    SELECT link, label, value
    FROM ...
    

    In your last example, sysdate week_2_time isn't a value or time.

    The format below for your query would work, but I doubt that is what your waiting for.

    SELECT NULL,
           'Me',
           TO_NUMBER (TO_CHAR (SYSDATE, 'mmddyyyy')) week_2_time,
           135 week_2_weight
      FROM DUAL
    

    Jeff

  • SQL serer: list of databases by using sqlcmd

    Hello

    I have MS SQL 2005 Express running on Windows 7.

    I don't have MS SQL Studio, Toad or etc. and must use only command prompt.

    I know that this server has tables and databases, etc.

    I first run this command:

    sqlcmd %-L

    It returns

    Then I run

    sqlcmd-s %

    1 exec sp_databases

    2. go

    It returns

    DATABASE_NAME DATABASE_SIZE REMARKS

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

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

    1.

    And that's all... that is, it did not return any name database.

    Then I run:

    "' sqlcmd-s % q" select * from information_schema.tables '.

    and it returns 5 names of tables.

    My question: how could I find the database name? Why it is not visible in my case?

    I guess that after I found the base name I could do ' use and then select the declaration...

    Thank you

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • The loading table Microsoft Sql serer flat file problem data

    Hi Experts,

    I am trying to load the data from the SQL Server table to the flat file but its errror on.

    I selected the staging of different shape area Targert (I use SQL Server as my sleeping area)
    Knowlegde modue used: IKM SQL to the file Append

    I have the following error reciee
    ODI-1217: Session table to file (124001) fails with return code 7000.
    ODI-1226: step table to file fails after 1 attempt.
    ODI-1240: flow of file fails during an operation of integration. This flow of charge table test target.
    ODI-1227: task table to file (integration) fails on the source of connection MICROSOFT_SQL_SERVER POS_XSTORE.
    Caused by: java.sql.SQLException: could not read file header lines
    to com.sunopsis.jdbc.driver.file.FileResultSet. < init > (FileResultSet.java:164)


    Help, please!

    Thank you
    Prateek

    Hello

    Have you made sure that the CSV file is readable by ODI? What I usually do is to create a CSV file example target with values in it. Once you create the model, right-click and view the data.

    HTH,
    Gerd

  • OR 9206 Delta sigma or SAR module?

    Hello

    I intend to use the library of waveform for cRIO OR cRIO 9074. I'm having the NI 9206 C series analog input module.

    The question I have is can I use the example of application of Delta-Sigma or the example of SAR acquisition mode.

    Basically, I want to know if the NI 9206 module is a module of delta sigma or a SAR.

    Appreciate your help.

    Swami HI,.

    9206 is a module of SAR, the Delta-Sigma tend to be 24 bits and they have very fixed sampling frequencies that they can run to, if you can set any rate sampling within a range, so it's SAR.

    See you soon,.

    James

  • How to create the sigma notation?

    Hmmm... I need help for the simple creation of sigma notation something like that the 1 in http://en.wikipedia.org/wiki/Summation, under the Capital sigma notation, 2 1.

    THX

    for (imstuck) wrote:

    Here, as it's low I'll post it. But try it yourself next time.

  • What are the changes that the installation of BizTalk has on the SQL instance?

    Original title: BizTalk.

    Hello.

    I want to install BizTalk.
    BizTalk and SQL are different servers.
    I would like to know what are the changes that the installation of BizTalk on the SQL instance.
    Can anyone help?
    Thkz

    Hello

    I know it's late to answer this question, just in case someone else look through this issue.

    BizTalk installation does nothing to SQL Server, but make BizTalk Configuration. When configure us BizTalk on any SQL Server (same or different), it creates the required databases and SQL Server works on this server.

    Here is a series of articles on installing and configuring BizTalk Server: http://sandroaspbiztalkblog.wordpress.com/2013/05/16/biztalk-2013-installation-and-configuration-install-and-configure-biztalk-server-2013-part-9/

    Thank you!

  • Canon lens EF 70-200mm L F4 USM + 2 X L series extender

    Hi, I have a Canon lens EF 70-200mm L F4 USM. Now, I want to buy an extension of series X L 2. Can someone help me by informing that AF can work with EF 70-200mm L USM F4 + 2 X Extender mounted on 650 d device and how much image quality I have to make compromises for the same thing.

    mithun_pal129 wrote:

    Thank you all for your valuable comments. I forgot to mention that my intension of extender to my EF 70-200mm L F4 USM in a telephoto lens for wildlife / birds. But now that I'm your stay in Abu Dhabi, he is not paid a lot of bird / wild life. This is why I don't want to spend a lot on super telephoto, and personally, I don't want to go to cheap Sigma lens. So I wanted to do objective 70-200mm + 2 Expander x 140-400 mm. As I myself feel 1.4 X extender is pretty good, but it will give me up to 280mm. I know that's not very good lens for bird / wild raise photography. But you want to know still is feasible or if I use 2 x Extender to make the 400mm autofocus lens is required for the wild life or manual focus can still operate at F8. I don't have a lot of experience in the photography of wild life that's why I wanted to know things.

    In a Word... N °

    Of a 2 X teleconverter on a 70-200/4 made for a lens of 140-400/8 "effective." Due to the reduction of light reaching the AF sensors, your camera will turn off autofocus. A stronger 2 X also "costs" more loss of quality of the image due to the deterioration.

    It is possible to tape on some of the electronic contacts on the focal length multiplier, so that the camera does not know it is there and always try to auto focus. However, the autofocus will be much slower and will tend to hunt much more.

    In some situations, you may be able to manually update. However, effective f8 makes for a pretty weak sight, most cameras update automatic modern as you do not have some fo the features allowing the development manual, vintage cameras designed for the manual focus had in the past. Some people change to one-third of frosted glass to add functionality to support manual focus (split finder image, micro diaprisms, for example). However this requires careful work to install the screen and the display of different can affect precision measurement of the camera, especially in the incorrect Spot metering.

    Addition of a lower 1.4 X teleconverter makes your lens in effect 112-280mm f5.6, who will still be updated with auto focus and will be much less loss of image quality, but not as much 'reach. If yours is a goal IS, it can reasonably be handholdable. If it is not a goal IS, you will need to watch your shutter speeds than blur carefully, probably should keep to 1/500 or more quickly to avoid the camera. Or use a tripod, as suggested by ebibgs, or at least a monopod. You also need to limit the autofocus on your camera to the central AF point only, I think.

    ebiggs1 wrote:

    On your camera, the 70-200mm f4 is like a 112-320mm f4.  With a converter 1. 4 x, looking at 448mm f5.6 and th elong end.  + 400 mm should be long enough for you to get photos of some birds.  BTW, use a tripod.

    While it is technically correct, citing the "crop camera lens factor" in this way may not help much, can be confusing.

    The original poster has simply a 70-200mm lens which they are accustomed to using on a crop sensor camera. They would now like to double the range of this lens on their camera. Crop sensor lens incorporating conversation factor is very useful when the user goes from frame of film/full to reframe the camera or vice versa. For someone who has never used a film camera or has not used one for many years and is now completely accustomed to how behaves a lens of focal length on their device to harvest, it is a completely moot point.

    But what he's basically saying that while you can add a 2 X, it is probably not a good idea for several reasons. Auto focus will work or not, with a few tips, won't work only weakly. Manual focus will be difficult. And the picture quality might take too big a hit, combining a 2 X with your goal. .

    I have a 70-200/4 IS, 70-200/2.8 IS ("Mark I"), 1. 4 X II and 2 X Teleconverters II. I also have long telephoto lenses, so rarely need to add these zooms teleconverter. However if necessary I would use 1.4 X on one of them. But even if AF still work on the 70-200/2.8 + 2 X combo, I won't use it because of the amount of loss of image quality (the most recent IS of 70 - 200/2.8 Mark II and 2 X Mark III are supposed to work together better, than my older versions of each).

    I use mostly 2 X on 300/2.8 and 500/4 lenses privileged where the image quality is still good. (Note: Yes, on some of my cameras 2 X 500/4 causes AF to stop working, as it would on your f4 lens, so I only use the combo on a limited basis.)

    mithun_pal129... I would say the more you get a 1. 4 X and use it with your goal. See if the image quality is to your expectations. Then work to get closer to your subjects. Or bring them closer to you. Practice the techniques of stalking and to study the behaviors of your subjects to discover ways to get closer. Work in a blind and use bait (food, calls). And start saving for a lens of longer focal length.

    The Canon 1.4 X II and III teleconverters are excellent. All Canon teleconverters have mated before elements that limit the lenses that they physically can be attached, but the 70-200 are among those where this is possible. Teleconverter Kenko is another that I see quite often recommended. They have two different levels of quality: a more expensive "Pro 300" version and a cheaper "MC - 4". These are currently offered in versions "DGX" whose operation is very similar to Canon teleconverters. Old Kenko teleconverters "DG" not "reported" to the camera, the camera didn't know they were there, so try to focus.  In the view of users and tests I've seen, the current Kenko Pro 300 DGX is pretty good overall of the entire image area. The MC - 4 cheaper is actually a little sharper in the Center, but not as strong in the corners and the edges of the image. Tamron and Sigma teleconverters also do, but I have little experience or knowledge of the current versions of the people.

    The wildlife/bird photography is not easy. Since no matter how long a goal that you have, there are times when the subjects are just out of reach and all you can go is to sit back and enjoy the show.

    These photos of small subjects with different, but close to or less than the effective focal length even lenses like your 70-200 mm + a 1. 4 X teleconverter would be on your camera...

    ***********
    Alan Myers

    San Jose, California, USA.
    «Market softly and carry a great lens.»
    MATERIAL: 5DII, 7D(x2), 50D(x3), some other cameras, various lenses & accessories
    FLICKR & REPROGRAPHY

  • SQL with weird returns

    Hello

    I am trying to load data from sql in my listview, purely on Qml. However, I keep coming back to a blank page and when I use console.log (data), I'll be back a series of repeated [object Object], [object Object], [object Object]...

    I don't know why that my query SQL statement works perfectly fine in SQLite Manager.

    A quick search online suggest that it has something to do with the type of data passed through, but I'm still not sure why.

    (Slap on my quote on my z30 because that somehow my Internet does not work when I try to connect to my Simulator will try to come back and edit my post later, but I can't disconnect my Simulator now)

    My listview (which I believe works very well, request to the ListItemData.Title, ListItemData.Subtitle, ListItemData.SerialName.

    I joined:

    Data model of the Group {Id: dataModel},.
    {} Data source
    ID: customdatasource
    Type: datasourcetype.sql
    Source: "sql/data.sql.
    Query: "SELECT title, subtitle, name FROM mytable ORDER BY codenumber series.
    The loaded data: {}
    Console.log ("data loaded") / / appears on the console
    DataModel.clear ();
    Datamodel.insertList (data);
    Console.log (Data) //producing error code
    }}

    I know it looks messy but still once, tap on mobile. Would be grateful for the help!

    Thank you!

    Realized it was my problem of paging. List worked well at the long... don't know if I'm happy or not on this subject

    Pls narrow thread thanks!

  • access denied while installing sql server 2008 r2 in win8 64bits

    Hello, I'm new here with poor English, so I'm sorry if I was rude.

    I have a problem when installing sql server in my laptop, the vaio e 14 p, with victory 8 series and its 64-bit, it seems family premium, so I think the problem is that my pc has no gpedit.msc, then I tried to download it online, but when gpedit.msc is done and I tried to install sql server 2008 r2 again the problem still the same "access denied" when the installation process is almost finished.

    I want to use sql server for my school task soon, so I hope you can help me.

    Thanks before.

    This issue is beyond the scope of this site and must be placed on Technet or MSDN
  • PL/SQL dynamic content

    Capture.jpg

    I use APEX 4.2.3 on Oracle 11 g R2.

    On my page, I have an IR base I have a column value up as a link to a URL that calls my function javascript in him passing a value of the report line.  Now, I want to display my modal window to display the data in the database for the value that was passed.  The pain I feel is the value of DOM in session state while my content area of pl/sql can be displayed.  The content of pl/sql is just a query that displays data in a tabular presentation specialist.  There are too many values to display in a report the reason for this type of area.  How can I get my DOM value in session state?  My javscript function is stuck.

    Thanks in advance.

    scottm wrote:

    Once again, my IR, a user clicks on the link and the modal display detailed information about the line that has been selected.  I can't really give a lot more other that my query will return just one row of data that will contain 34 columns.  If I set it up as a classic report, it works perfectly, but my users want not displayed like this because they will have to scroll to see all the content.  So my specialized table is really a series of tables stacked with 4 columns each.  I keep thinking of a way to make a report model to view it as I want to, but do not find a way to do it again.  I tried the model "attribute value pairs", but it did not fit on the page completely.  The image below is what I'm shooting.

    This layout of the table can be created in a custom report named column model, convert query result of single line into several lines of an HTML table. Something like this:

    Front of the lines


    Model of line 1

      
    ...

    and so on

    After the lines

    Plant NamePlant TypePlant OwnerYear Built
    #PLANT_NAME##PLANT_TYPE##PLANT_OWNER##YEAR_BUILT#
    Vessel LengthDisposal TypeEmpty DisplacementOcean Certified
    #VESSEL_LENGTH##DISPOSAL_TYPE##EMPTY_DISPLACEMENT##OCEAN_CERTFIED#

    However, in my opinion, this is limit his use of a table, and I agree with you that the attribute/value pairs (i.e. a list of description) is the correct HTML representation for this data. Assuming suitable browser support, the report can use the model of attribute/value pairs, and then enroll in the space required by displaying it on several columns using a CSS3 multi-column layout.

  • SQL question on natural joins

    I am a newbie to SQL and I studied the book of Fundamentals SQL Server Oracle OCA 12 c, but a section on natural joins to confuse me.

    Basically, the author says:

    SELECT r.region_name, d.department_name, l.city, c.country_name

    DEPARTMENTS d

    NATURAL JOIN places l, c countries, regions r;

    The natural join between DEPARTMENTS and LOCATIONS creates a provisional result, consisting of 27 lines since they are implicitly attached on the column of location_id. This set is then Cartesian-joined to the table of the COUNTRY as a join condition is not implicitly or explicitly specified. 27 interim lines are attached to 25 lines in the COUNTRY table, which gives a new temp results set with 675 (27 × 25) rows and three columns: DEPARTMENT_NAME, CITY and COUNTRY_NAME. This set is then attached to the REGION table. Once more, a Cartesian join occurs because column REGION_ID is absent from any join condition. The final result set contains rows and four columns (675 × 4) 2700.

    I can understand because you evaluate joins from the left. But then he wrote:

    The JOIN... USE and JOIN... ON the syntaxes are better suited to join multiple tables. The following query joins four tables using the natural join syntax:

    SELECT country_id region_id, c.country_name, l.city, d.department_name

    DEPARTMENTS d

    NATURAL JOIN places l

    NATURAL JOIN country c

    NATURAL JOIN region r;

    This query generates correctly 27 lines in the final results set since the required join columns are listed in the SELECT clause. The following query illustrates how the JOIN... CLAUSE is used to extract the same 27 lines. A join condition can reference columns only in its scope. In the following example, the join of DEPARTMENTS slots can not reference columns in the COUNTRIES or REGIONS of tables, but the join between the COUNTRIES and REGIONS may refer to any column of four tables involved in the query.

    This second method of the part of the natural writing joined confuses me. I don't understand the logic behind the 2nd series of States of Natural Join. For me, it seems that the first series and the 2nd set look alike, but they are apparently not.

    Can someone tell me the differences?

    Thank you!!

    Hello

    The more important thing to learn more about NATURAL JOIN is: never use it.  If you add new columns, joins can get different results.  I've never heard of someone uisng NATURAL JOIN apart from a manual or a question like yours.

    There are a lot of things in Oracle that take the time to learn and are useful.  All the time you spend learning things is better spent on them.

  • Using SQL to ensure the matching records are mutually exclusive.

    There are two tables defined in the following way:

    Table A

    Number 1

    Number 2

    Date

    ROWID

    Table B

    Number 1

    Number 2

    Date

    Identifier of the line

    Each table stores a call between number 1 and 2 on a specific date. The goal is to map exactly one entry of table A with exactly the record in table B

    in a mutually exclusive way. So a single call to a table must be associated with exactly one call the other table (the key is here

    A.Number1 is B.Number1 and A.Number2 = B.Number2). Because it is a relationship is many to many (the number of source and destination may be paired multiple)

    (time), I'm not able to build a series of sql statements that will allow me to get a relationship one between pairs of telephone numbers.

    I'm not allowed to develop a PL/SQL procedure, which would easily solve this problem.

    I was able to find a solution using MIN(Number 1) KEEP (DENSE_RANK FIRST ORDER BY Date) to THE (PARTITION BY x) the form x

    using temporary tables, which allows me to reach a breaking successively much many relationships (i.e. three broken bones in a 01:58 after

    an iteration, and after one iteration, I arrive at a one to one relationship). However, I can't break these relations some n number of times because it requires number n

    hard curls. Therefore, I need a sophisticated solution that will allow me to achieve a relationship one by one.

    Example of

    Table A

    Record 1

    Number 1:451923456789

    Number 2:541969432045

    Date: 29/07/2015-09:01

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:03

    Table B

    Record 1

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:04

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:05

    If we unite our table A and B by A.Number1 = B.Number1 and A.Number2 = B.Number2, we have 4 records. I'm looking for exactly two records.

    The criteria is to associate by the minimum of the sum of the date of the table A table B date. Therefore, the final result should match:

    (1) record 1 of table A with record 1 of table B.

    sheet 2) 2 table A with 2 record in table B.

    So we must do something to reduce the 4 records resulting from the join of two records describe as we see above.

    The result of the join:

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    Rank 3: TableA.Record2 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    What I'm looking for, which is easily achievable with a slider, but not with SQL:

    1st row: TableA.Record1 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    Note that if the minimum date condition allows us to select the necessary records, we won't get the expected results. In other words, using the minimum date.

    the results will be:

    1st row: TableA.Record1 with TableB.Record1

    Rank 3: TableA.Record2 with TableB.Record1

    (criteria - table a minimum date)

    or

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    (criteria - date minimum table B)

    Two of these results to break the rule are mutually exclusive.

    Post edited by: 3000640

    If I understand correctly, something like:

    SQL > with tableA (id, telephone1, telephone2, call_date) as)

    2. Select 1, ' 451923456789 ', ' 541969432045',

    3 to_date (July 29, 2015 09:01 ', 'dd.mm.yyyy hh24')

    4 union double all the

    5. Select 2, ' 451923456789 ', ' 541969432045',

    6 to_date (July 29, 2015 09:03 ', 'dd.mm.yyyy hh24')

    double 7),

    TableB 8 (id, telephone1, telephone2, call_date) as)

    9. Select 1, ' 451923456789 ', ' 541969432045',

    10 to_date (July 29, 2015 09:04 ', 'dd.mm.yyyy hh24')

    11 double Union all the

    12. Select 2, ' 451923456789 ', ' 541969432045',

    13 to_date (July 29, 2015 09:05 ', 'dd.mm.yyyy hh24')

    14 double)

    15 select a.id help, a.phone1 aphone1, a.phone2 aphone2,

    16 a.call_date acall_date, b.id offer, b.phone1 bphone1,

    17 b.phone2 bphone2, b.call_date bcall_date

    18 (select id, telephone1, telephone2, call_date,

    19 row_number() over (partition by numbers1, telephone2

    RN 20 order by call_date)

    tablea 21) a

    22 join (select id, telephone1, telephone2, call_date,

    23 row_number() over (partition by numbers1, telephone2

    RN 24 order by call_date)

    tableb 25) b

    26 on a.phone1 = b.phone1 and

    27 a.phone2 = b.phone2 and

    28 a.rn = b.rn;

    HELP APHONE1 APHONE2 ACALL_DATE BPHONE1 BPHONE2 BCALL_DATE OFFERS

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

    1 451923456789 541969432045 July 29, 2015 09:01 1 451923456789 541969432045 July 29, 2015 09:04

    2 451923456789 541969432045 July 29, 2015 09:03 2 451923456789 541969432045 July 29, 2015 09:05

    John

  • case in PL/SQL where clause statement

    • Hello
    • I have a research procedure where the user can search on the city, street, zip code.
    • I need meet the 6 different combinations as I don't know what value the user will pass.
    • It should be checked if the user passes the value or not, and then look on values passed.
    • But the procedure below is out.it the slightest mistake can be transformed with if-then-else, but case statement seems much cleaner in the code.
    • procedure searchaddress (pc_town IN SEARCHADDRESS. CITY % TYPE,

    pc_street IN SEARCHADDRESS. TYPICAL STREET %,

    pc_postcode IN SEARCHADDRESS. POSTCODE % TYPE,

    pResultSet to ref_cursor) as

    Start

    Open the pResultset for

    Select searchaddress_pk from searchaddress

    where

    case

    When pc_town is null then ((street = pc_street) and (ZipCode = pc_postcode))

    When pc_street is null then ((town = pc_town) and (ZipCode = pc_postcode))

    When pc_postcode is null then ((town = pc_town) and (street = pc_street))

    When pc_town is null and pc_street is null then (postal code = pc_postcode)

    When pc_street is null and pc_postcode is null then (city = pc_town)

    When pc_town is null and pc_postcode is null then (street = pc_street)

    end

    end searchaddress;

    Thank you

    CenterB

    A basic concept that is important to understand - sliders aren't 'sets of results' (sets of data in memory). A cursor is a series of executable steps (see plans run to cursor). It's like a program. An extraction run the program and output data. In general, which is repeated until the cursor (aka program) is no longer found the corresponding lines.

    A ref cursor is a pointer or a handle for a such slider, passed to a caller, allowing the appellant to interface directly with this slider/program.

    The slider more effective to create a search would be one without superfluous code and predicates and filters. Consider the following approach - a beefier PL/SQL procedure, do not try and play little tricks with SQL predicates in an attempt to create one (and probably not optimal) SQL.

    (not tested/compiled code)

    create or replace procedure SearchAddress(
      town     IN SEARCHADDRESS.TOWN%TYPE,
      street   IN SEARCHADDRESS.STREET%TYPE,
      postcode IN SEARCHADDRESS.POSTCODE%TYPE,
      refCur out ref_cursor
    ) is
      curHandle integer;
      res integer;
      searchSQL varchar2(1000);
    begin
      -- create base query
      searchSQL := 'select searchaddress_pk from searchaddress where 1 = 1 ';
    
      -- add dynamic predicates as needed
      if town is not null then
        searchSQL := searchSQL || 'and town = :town';
      end if;
    
      if street is not null then
        searchSQL := searchSQL || ' and street = :street';
      end if;
    
      if postcode is not null then
        searchSQL := searchSQL || ' and postcode = :postcode';
      end if;
    
      -- create a DBMS_SQL cursor
      curHandle := DBMS_SQL.open_cursor;
      DBMS_SQL.parse( curHandle, searchSQL, DBMS_SQL.NATIVE );
    
       -- bind the dynamic bind variables added as predicate values
      if town is not null then
        DBMS_SQL.Bind_Variable( curHandle, 'town', town );
      end if;
    
      if street is not null then
        DBMS_SQL.Bind_Variable( curHandle, 'street', street );
      end if;
    
      if postcode is not null then
        DBMS_SQL.Bind_Variable( curHandle, 'postcode', postcode );
      end if;
    
      -- execute cursor (to create the cursor program) and pass it back as a ref cursor
      res := DBMS_SQL.Execute( curHandle );
      refCur := DBMS_SQL.To_RefCursor( curHandle );
    end;
    

Maybe you are looking for

  • Can I go back to the previous version of Firefox, before the last update?

    Firefox is automatically promoted to the 34.0.5 do not know what I had before, but I want to go back to what version came before that. I hate what spent my field of research. The only reason why I didn't completely Chrome switchd was the facility to

  • Downloads blocked

    RE: Downloads blocked I try to download a driver for my laptop and get the following message: "Cannot start Service EHR - this driver has been blocked by a load." My computer is a HP Pavilion dv7 1232nr with Vista Home Premium 64 bit operating system

  • Leider druckt der pdf-Dateien ohne Inhalt. Active die Maske group, text aber nicht eingefugter wird.

    Hallo! Den nutze ich Foxit reader. Leider druckt der pdf-Dateien ohne Inhalt. Active die Maske group, text aber nicht eingefugter wird. Hat eine idea someone? Danke, tanja_elke

  • Error opening Microsoft word blue screen

    Original title: blue screen Everytime I open my laptop MS Word stops and displays a blue screen. When you restart the laptop, it gives the following error message: Signature of the problem: Problem event name: BlueScreen OS version: 6.1.7600.2.0.0.76

  • HP Notebook PC 15: create system recovery media

    my laptop has a message asking to "create a system recovery media. Since the purchase of the laptop, I have upgraded to win10 (the free version online), of win8.1, which I upgraded to 8.0 immediately after purchase. I have a set of 3 drive recovery I