Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Robert Konig

@Robert Konig
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get value from outer to inner SELECT
    R Robert Konig

    This is my query now:

    SELECT ID,
    DAY
    FROM (SELECT ROWNUM as CAL_ROWNUM,
    DAY AS MAX_CALENDAR_DAY
    FROM (SELECT DAY
    FROM CALENDAR
    WHERE DAY > TRUNC(TO_NUMBER(SYSDATE - TO_DATE('01.01.1970', 'DD.MM.YYYY')))
    AND CALENDAR.IS_WORKING_DAY= 'y'
    ORDER BY CALENDAR.DAY)
    WHERE ROWNUM <= (SELECT MAX(NR_OF_DAYS)
    FROM WORKCENTER
    WHERE ID IN (1, 2, 6, 7, 9))
    )
    INNER JOIN WORKCENTER
    ON NR_OF_DAYS = CAL_ROWNUM
    WHERE ID IN (1, 2, 6, 7, 9)

    And it works, yeah! Thanks guys. Greetings

    Database database help tutorial oracle question

  • How to get value from outer to inner SELECT
    R Robert Konig

    Hello, i am at the beginning of learning SQL, and i cannot find the solution to my problem: I have got two tables, WORKCENTER and CALENDAR. WORKCENTER contains columns ID and NR_OF_DAYS, CALENDAR Contains columns DAY and IS_WORKING_DAY. DAY contains the numeric value of a day (for example 14824 for today, 2010-08-03), and IS_WORKING_DAY is CHAR Type and indicates with 'y/n' if it is a working day or not. I want for each Work Center to get the day from today + NR_OF_DAYS from table CALENDAR, excluding weekends and holidays. The result should be like this:

    ID MAX_CALENDAR_DAY
    1 14833
    2 14840
    ...

    Explanation: Work Center 1 has NR_OF_DAYS = 7, today is 14824, + 7 = 14831, but there is a weekend in between, so + 2 = 14833. Work Center 2 has NR_OF_DAYS = 12, today is 14824, + 12 = 14836, but there are two weekends in between, so + 4 = 14840. This is my sql query (Oracle):

    SELECT WORKCENTER.ID AS WORKCENTER_ID, MAX_CALENDAR_DAY
    FROM WORKCENTER,
    (SELECT MAX(DAY) AS MAX_CALENDAR_DAY
    FROM (SELECT DAY
    FROM CALENDAR
    WHERE DAY > TRUNC(TO_NUMBER(SYSDATE - TO_DATE('01.01.1970', 'DD.MM.YYYY')))
    WHERE CALENDAR.IS_WORKING_DAY= 'y'
    ORDER BY CALENDAR.DAY
    )
    WHERE ROWNUM <= WORKCENTER.NR_OF_DAYS
    )
    WHERE WORKCENTER.ID IN ( 1, 2, 6, 7, 9)

    Oracle SQL Developer shows an error, WORKCENTER.NR_OF_DAYS is unknown. This is obvious, if inner queries are handled first (is this correct?). Could you tell me how i have to build this query? I hope you see what i am trying to do... Greetings

    Database database help tutorial oracle question

  • How to create an empty tableAdapter or deliver a tableAdapter to extern function
    R Robert Konig

    This way i could go, but i wanted something little different: I don't want to create an adapter with just one SELECT command, rather i would like to go on something like this: public void myFunction(DataSet myDataSet, "TableAdapter" myTableAdapter) { // working with both } Or this: public void myFunction(DataSet myDataSet) { "TableAdapter" myTableAdapter = myDataSetTableAdapterCollection.TableAdapter[0]; } Then i could use all the SQL commands of this TableAdapter, and don't have to write them manually.

    C# question database tutorial announcement

  • How to create an empty tableAdapter or deliver a tableAdapter to extern function
    R Robert Konig

    Hello community! I'm new here. My Question is: Is it possible to create a TableAdapter programmatically or deliver it to an extern function? The reason: I want to create an Class Library which should take care of DataBase activities in my application. One reason is a function i wrote that compares the loaded Row with the Row in DataBase before sending an Update-Command, which i want to use in all applications. My consideration: The Library contains an class "DBCaretaker". On creating this class, it receives the DataSet and the TableAdapters. After that, filling DataSets, Updating Tables and further actions will be executed by functions in this Library. Is this possible? Or do you have an alternative proposal? Greetings, Robert

    C# question database tutorial announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups